一、需求
上传文件到指定的服务器或者网址中
二、代码
[Python] 纯文本查看 复制代码 import requests
p_url = 'https://xxxxxxx.com' # 网址或者服务器地址
def upload_files(url):
parms_info = {
"front_image": open(r"D:\Desktop\500.jpeg", 'rb'),
"backward_image": open(r"D:\Desktop\500.jpeg", 'rb'),
"left_image": open(r"D:\Desktop\500.jpeg", 'rb'),
"right_image": open(r"D:\Desktop\500.jpeg", 'rb'),
"top_image": open(r"D:\Desktop\500.jpeg", 'rb'),
"bottom_image": open(r"D:\Desktop\500.jpeg", 'rb')
}
ret = requests.post(url, files=parms_info)
return ret
ret = upload_files(p_url)
print(ret.json())
|