Possible Duplicate:
Python: HTTP Post a large file with streaming
I'm writing a program that uploads large amounts of data over http (specifically to Amazon Glacier but that's irrelevant), and I'm looking at ways to reduce the memory overhead.
The current situation is basically: - read part of file in memory, - upload file to server.
The problem is, part is large, up to 4096 MB, and that's simply a waste of memory to store it all in RAM. I'm looking for a way to cut down the memory to no more than 1 MB.
I have been looking at
HTTPConnection.request(method, url[, body[, headers]])
where body may be an open file (no need to copy this to memory; just read from disk and it's fine): the problem is that I do NOT want to send a complete file in one go, rather arbitrary parts of that file. However short of creating a new file with just that part of data, I don't know how to handle this.