3

I am using the mechanize library in python to download some large files from a server. I need to implement partial file download so that I can parallelize the download of the file. For that, I added the header "Range: bytes=0-499" to my request. But the server returns the file starting from the 499th byte.

The server uses HTTP 1.0. Is there a way to download the file file partially using python?

UnadulteratedImagination
  • 1,971
  • 2
  • 13
  • 15
  • 1
    refer this. http://stackoverflow.com/questions/1798879/download-file-using-partial-download-http – Chathuranga Apr 26 '13 at 08:18
  • 1
    You could also use `gevent` to download the files in a separate greenlet, seemingly concurrently. I'm sure you could even patch @Chathuranga suggestion to work with it. [Check this question out](http://stackoverflow.com/questions/6905800/multiprocessing-useless-with-urllib2). – msvalkon Apr 26 '13 at 08:21
  • I tried adding the range header to the GET request, but the server instead assumed that I needed the rest of the file instead of only the partial content. My question is : Is that because the server is using HTTP/1.0 and not HTTP/1.1 ? – UnadulteratedImagination Apr 26 '13 at 09:32

1 Answers1

0

I'm afraid I don't have enough reputation yet to comment so pardon the answer but I believe what you seek is here;

The Key Differences between HTTP/1.0 and HTTP/1.1

Look under "Bandwidth Optimisation" and "Range Requests" about 25% of the way down the page.

There was no way in HTTP/1.0 to request partial objects.

Whilst some HTTP/1.0 servers have had some HTTP/1.1 features added, I'm afraid this doesn't seem the case on your server.

You would be able to tell that it accepted ranges too if the server responded with something like to following:

Accept-Ranges: bytes
Ewan
  • 14,592
  • 6
  • 48
  • 62