如下图的图片上传接口,查看formdata数据格式
对应的Python上传代码,主要看files的构成
import requests
url = 'https://deepart.io/image/upload/content'
headers={
'User-Agent':'Chrome/71.0.3578.98 Safari/537.36'}
files = {
'image':('123.jpg',open('F:\\图片\\123.jpg', 'rb'), 'image/jpeg') # image或者file
}
r = requests.post(url=url, headers=headers, files=files)
r.raise_for_status()
print(r.text)
print(r.status_code)