def upload_text(file, arg):
postfix = file.split('.')[-1]
with open(file, 'r') as f:
start_time = time()
ufile = requests.post(
text_server,
data={arg: f.read(),
'content_type': 'application/octet-stream'})
end_time = time()
url = ufile.text
url = url.strip()
url = url + "/{}".format(postfix)
usage_time = round(end_time - start_time, 2)
print('upload time: {}s'.format(usage_time))
try:
pyperclip.copy(url)
except NameError:
pass
except:
pass
return url
评论列表
文章目录