I have this code python requests code snippet(part) to upload a file and some data to the server:
files = [("FileData", (upload_me_name, open(upload_me, "rb"), "application/octet-stream"))]
r = s.post(url, proxies = proxies, headers = headers, files = files, data = data)
Since this will read the whole file into memory, which may cause some issues in some situations. From the requests documentation, I know it supports streaming uploads like this:
with open('massive-body') as f:
requests.post('http://some.url/streamed', data=f)
However I don't know how to change my original code to support streaming. Anyone can help please?
Thanks.