开发者

How do i estimate download time when response header does not contain content-length?

开发者 https://www.devze.com 2023-01-27 06:45 出处:网络
how do i estimate download progress/time when the file to be downloaded lacks the 开发者_高级运维content-length information? ThanksYou you find yourself in the rather improbable situation that the ser

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
0

精彩评论

暂无评论...
验证码 换一张
取 消