[BangPypers] How to check file size before downloading it

S.Ramaswamy srsy70 at gmail.com
Wed May 7 18:49:59 CEST 2008


On Wed, May 7, 2008 at 4:49 PM, Gurpreet Sachdeva
<gurpreet.sachdeva at gmail.com> wrote:
> Is there a way in urllib to check file size (from the webserver) before
> downloading it? Or any other python module from this?
>
Just a nit.  It might be a good idea to check for the existence of the
Content-Length header before trying to  find it's value. It's quite
common to find web servers that do not report this header. (Now you
know one reason why progress bars can be cranky at times : )

Ramaswamy


More information about the BangPypers mailing list