coding:utf-8
from requests_toolbelt import MultipartEncoder
import requests
s = requests.session()
s.verify = False
url = “https://ai.”
m = MultipartEncoder(
fields=[
(“file”, (“3.jpg”, open(“E:\myfiles\tupian\3.jpg”, “rb”), “image/jpeg”)),
(“app_key”, “YXR6ajI0MzZmMDh0dWd5”)
]
)
r = s.post(url, data=m, headers={“Content-Type”: m.content_type})#头部写法一定要注意
print(r.text)