How do i estimate download time when response header does not contain content-length?
how do i estimate download progress/time when the file to be downloaded lacks the 开发者_高级运维content-length information? Thanks
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
精彩评论