check if an URL exists without opening it

David david at nospam.com
Fri Aug 9 17:09:35 EDT 2002


Thanks for your answer.
But how GetRight or Gozilla work or Download Accelarator plus ?

It seems to me that they check the existence before beginning the download.

"Michael Chermside" <mcherm at destiny.com> wrote in message
news:mailman.1028922395.8815.python-list at python.org...
> > I would like to check if an URL exists.
> > (for instance http://www.yahoo.com/try.pdf)
> >
> > The method urllib.open is unsatisfactory because the URL (which will be
a
> > file in my program) is opened ! So it can take too long time, just to
check
> > the existence !
>
> Unfortunately, this is impossible for many kinds of URLs. http: urls,
> for instance, can only be detected by an attempt to download them.
>
> 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.
>
> -- Michael Chermside
>
>
>
>
>





More information about the Python-list mailing list