How can i find a file size on the web ?

Dan Upton upton at virginia.edu
Sun Dec 2 12:12:16 EST 2007


On Dec 2, 2007 11:55 AM, Abandoned <besturk at gmail.com> wrote:
> Hi..
> Can i find a file size witdhout download?
> For example: www.roche.com/rochea_z_sp.pdf
> How can i find its size with python ?


When you send an HTTP request, most servers will respond with the
content length.  For instance, if you go to http://web-sniffer.net/,
you can type in the file you want to view and you can see the header
sent and received, and for the example you gave, you'll notice the
HTTP Response Header includes a line

Content-Length: 4054802

That should be the information you're looking for.



More information about the Python-list mailing list