Question

how do i estimate download progress/time when the file to be downloaded lacks the content-length information? Thanks

Was it helpful?

Solution

You you find yourself in the rather improbable situation that the server won't send you content lengths but accepts byte range requests (and you really really need to know how long it'll take), you can use the code in Python seek on remote file using HTTP and do a binary search to get some notion about the file size. Ask for a range beyond the file size and you'll receive:

HTTPError: HTTP Error 416: Requested Range Not Satisfiable
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top