I'm expecting problems with using requests, i try to send huge file (1GB) via requests, but script that i'm using seems to sending data is trying to upload whole file at once. I tryed to implement 'chunks' but implementing it causes that script uploads files but in multiple connections. (for example 1MB file sends 1MB file but in 1kb parts that causes that script is connecting to the same address 1024 times)
I backuped my old code with tryes upload whole file at once:
with open(local_path, 'rb') as file_obj:
files = MultipartEncoder({'files[]': (filename, file_obj, 'application/octet-stream')})
UploadFile = requests.post(self.UploadURL, data=files, headers={'Content-Type': files.content_type}, stream=True)
How to upload whole file, but sended in 1MB chunks, in one connection?
I mean:
-Python is reading file (in 1MB parts)
-Python opens post connection
-Python sends 1MB part
-Python waiting to part being sended
-Python is reading file (in 1MB parts)
-Python sends 1MB part
...