check if an URL exists without opening it

Andy McKay andy at agmweb.ca
Sat Aug 10 16:22:32 EDT 2002


> You COULD try opening the URL and then abandoning the download as soon 
> as you get the first few bytes of the content, but I wouldn't advise it. 
> A huge amount of the overhead is in creating the TCP/IP connection and 
> sending HTTP headers.. if there's a reasonable chance you'll want to 
> download the contents of the URL I'd go ahead and do it.

http://www.agmweb.ca/Scripts/is404

Uses httplib and HEAD
--
  Andy McKay
  Agmweb Consulting
  http://www.agmweb.ca







More information about the Python-list mailing list