Size of a remote URL

Dave Brueck dave at pythonapocrypha.com
Mon Aug 30 11:17:12 EDT 2004


Justin wrote:

> I am attempting to create a tuple of file sizes from a list or URLs.
> Unfortunately not all files are returned with a "Content-Length"
> header.  Does anybody knwo a more absolute or reliable way to get the
> size of a remote file through its URL?  Possibly a lower level http
> request than simply reading the MIME headers?  Thanks to anyone who has
> a suggestion

If the server won't tell you the size of the object, then the only other 
thing you can do is download the object yourself and compute its size - 
there's nothing else you can do.

The size is often not reported if the content is being generated on the 
fly. Anyway, maybe there's another way to solve the problem you're 
working on - why do you need to know the sizes?

-Dave



More information about the Python-list mailing list