[Python-Dev] Time-out in URL Open (original) (raw)
Guido van Rossum guido at python.org
Tue Jul 4 23:58:04 CEST 2006
- Previous message: [Python-Dev] Time-out in URL Open
- Next message: [Python-Dev] Time-out in URL Open
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 7/4/06, Facundo Batista <facundobatista at gmail.com> wrote:
2006/7/3, Guido van Rossum <guido at python.org>:
> To fake things like this, socket.setdefaulttimeout() was added, though > I don't know if it actually works. Have you tried that? This affect all the sockets.
So, assuming your app is single-threaded, set the timeout, call urlopen(), and reset the timeout to None.
And I hit the problem when servicing information with a web service (TCPServer), and I need to timeout the connection of the URLOpen only.
That's not so easy even if you were to have a timeout parameter to urlopen(). You'd have to implement that peculiarity in all the layers (in this case, urllib and httplib; and possibly ftplib, gopherlib etc. :-)
-- --Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] Time-out in URL Open
- Next message: [Python-Dev] Time-out in URL Open
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]