A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-July/066990.html below:

[Python-Dev] Time-out in URL Open

[Python-Dev] Time-out in URL OpenGuido van Rossum guido at python.org
Tue Jul 4 23:58:04 CEST 2006
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/)
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4