Uploading a file using python requests

List here just for a reminder:

1
2
3
4
5
6
7
url = "http://34.207.223.236"

files = {"file": open("c:\\a.csv", 'rb')}

response = requests.post(url, files=files)

print(response.text)

requests will send a multi-part form POST body with the upload_file field set to the contents of the a.csv file.

唐胡璐 wechat
欢迎您扫一扫上面的微信公众号,订阅我的博客!
分享创造价值,您的支持将鼓励我继续前行!