No way to set a timeout in "urllib".

John Nagle nagle at animats.com
Sat Dec 30 02:36:19 EST 2006


skip at pobox.com wrote:
>     John> There's no way to set a timeout if you use "urllib" to open a URL.
>     John> "HTTP", which "urllib" uses, supports this, but the functionality
>     John> is lost at the "urllib" level.
> 
>     John>     It's not available via "class URLopener" or "FancyURLopener",
>     John>     either.
> 
>     John> There is a non-thread-safe workaround from 2003 at
> 
>     ...
> 
> This topic has come up several times since timeouts were added to socket.
> Each time we've asked for a patch that adds timeouts in a rational manner to
> all the stuff layered on top of the socket module (httplib, ftplib, etc). As
> far as I know it's apparently never been important enough for anyone to rise
> to the challenge.  If I remember next spring perhaps I'll submit it as a
> possible Google Summer of Code proposal.

     It ought not to take more than a day or two, although it is annoying
that you have to deal with the problem at several levels.

     If you're looking for a Summer of Code project, consider finishing
the Python SSL library, which doesn't even check certificates, let alone
revocation lists.  It's a pure interface problem.  OpenSSL does all the
hard parts, but the Python glue code is crude and incomplete.

					John Nagle



More information about the Python-list mailing list