I am programming a software in Python to download HTTP PDF from a database. Sometimes the download stop with this message :
retrieval incomplete: got only 3617232 out of 10689634 bytes
How can I ask the download to restart where it stops using the 206 Partial Content
HTTP feature ?
I can do it using wget -c
and it works pretty well, but I would like to implement it directly in my Python software.
Any idea ?
Thank you
You can request a partial download by sending a GET with the
Range
header:Be careful to check the
Content-Range
to learn what bytes have actually been downloaded, since your range may be out of bounds, and/or not all servers seem to respect theRange
header.