Can urllib be used with nonblocking sockets?

Gerhard Häring gh at ghaering.de
Wed Apr 30 09:51:05 EDT 2003


Arne Schwabe wrote:
> Hi,
> 
> I have written a little python program that uses non-blocking sockets
> with select and I now want to urrlib in my program and I cannot find a
> method in urllib that would allow me to tell urllib that it should use
> non blocking sockets.
> 
> Is there a easy solution to this? One solution would to do implement
> something like a non blocking urllib but I don't want to do that.

<insert standard Twisted response here>

I haven't used these myself yet, but

http://www.twistedmatrix.com/documents/TwistedDocs/current/api/public/twisted.web.client.HTTPDownloader.html

seems to do what you want for HTTP and

http://www.twistedmatrix.com/documents/TwistedDocs/current/api/public/twisted.protocols.http.HTTPClient.html

is a more low-level interface (like httplib in the std. lib. is).

-- Gerhard





More information about the Python-list mailing list