python图片上传
作者:互联网
from requests_toolbelt import MultipartEncoder
import requests
def picupload(picname):
m = MultipartEncoder({'image': (picname, open(picname, 'rb'), 'image/jpeg')})
params = {}
response = requests.post('https://api.saic-itech.com/rest/image/vehicle-license?app_id=9999&secret_key=a397454eb95b4b13a60ce98d48abac27',
params=params,
data=m,
headers={'Content-Type': m.content_type})
print("1: ", response.text)
#print("2: ", response.request.body)
#print("3: ", response.request.headers)
if __name__ == '__main__':
picupload("1.jpg")
young0310
发布了0 篇原创文章 · 获赞 0 · 访问量 7
私信
关注
标签:__,python,image,picname,params,print,上传,response,图片 来源: https://blog.csdn.net/young0310/article/details/103990320