| Store | Cart

urllib.getsize()

From: Gerrit Holl <gerr...@pobox.com>
Fri, 19 Nov 1999 13:34:04 +0100
Skip Montanaro wrote:
> >     Gerrit> I've written a function to get the size of a HTTP/FTP url, is it>     Gerrit> good enough to be put in urllib.py?> > My only worry is that HEAD doesn't always work (for whatever reason having> to do more with servers than clients).  Would it be better to wrap things in> a try/except block?

Oh. Yes, I think getsize() should return -1 or None or an error if HEAD
doesn't work. Just doing a GET then isn't good, of course ;-)
Another problem: does every HTTP server give the Content-Length header?

> Anyone have a URL that fails with HEAD?

I don't have one.

regards,
Gerrit.

-- 
"We all know Linux is great...it does infinite loops in 5 seconds."
(Linus Torvalds about the superiority of Linux on the Amterdam
Linux Symposium)

Recent Messages in this Thread
Gerrit Holl Nov 18, 1999 08:39 pm
Skip Montanaro Nov 18, 1999 09:50 pm
Gerrit Holl Nov 19, 1999 12:34 pm
Messages in this thread