这应该可以,但是它适用于非常大的文件。
import requestsurl = 'https://api.example.com/api/dir/v1/accounts/9999999/orders'headers = {'Authorization' : ‘(some auth pre)’, 'Accept' : 'application/json', 'Content-Type' : 'application/json'}r = requests.post(url, data=open('example.json', 'rb'), headers=headers)
contents = open('example.json', 'rb').read()r = requests.post(url, data=contents, headers=headers)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)