如下图的图片上传接口,查看formdata数据格式

Python requests 文件上传接口

对应的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)

相关文章:

  • 2021-08-23
  • 2021-08-29
  • 2022-12-23
  • 2022-12-23
  • 2021-08-31
  • 2022-01-15
  • 2022-12-23
猜你喜欢
  • 2021-12-17
  • 2022-12-23
  • 2021-09-19
  • 2022-12-23
  • 2022-12-23
  • 2021-06-12
  • 2021-09-19
相关资源
相似解决方案