[Python-Dev] Adding timeout option to httplib...connect()

Guido van Rossum guido at python.org
Fri Feb 9 21:08:26 CET 2007


On 2/9/07, Fred L. Drake, Jr. <fdrake at acm.org> wrote:
> On Friday 09 February 2007 08:52, skip at pobox.com wrote:
>  > In principle it's probably a fine idea.  We should consider if it's
>  > possible to develop a uniform approach to timeouts for all the libraries
>  > that use sockets though.  Otherwise you run the risk of doing it in
>  > different ways for different libraries and having to make a (small, but
>  > annoying) semantic leap when going from, say, httplib to smtpllib or
>  > ftplib.
>
> Agreed.  In the meanwhile, there's socket.setdefaulttimeout(), which has
> proved quite useful.

Didn't work for me, since my ap is a multi-threaded webserver and I
only want one specific type of request to time out.

I'm not going to change ftplib.py and all the others.

I do think it's relevant to decide whether the timeout should be
passed to the constructor or to the connect() method. I think it may
be better to pass the timeout to the constructor.

>   -Fred
>
> --
> Fred L. Drake, Jr.   <fdrake at acm.org>
>


-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list