[Python-Dev] Time-out in URL Open

Alex Martelli aleaxit at gmail.com
Wed Jul 5 18:42:54 CEST 2006


What about doing it with a per-thread-timeout in TLS (overriding the
global one if a thread does have it set in its TLS)?  Not as clean,
but perhaps far easier to implement than patching dozens of
modules/functions/classes to provide timeout= options everywhere...


Alex


On 7/5/06, Guido van Rossum <guido at python.org> wrote:
> OK, you've convinced me. Now where's that SF patch you were promising? :-)
>
> --Guido
>
> On 7/5/06, Facundo Batista <facundobatista at gmail.com> wrote:
> > 2006/7/4, Guido van Rossum <guido at python.org>:
> >
> > > > This affect all the sockets.
> > >
> > > So, assuming your app is single-threaded, set the timeout, call
> > > urlopen(), and reset the timeout to None.
> >
> > No, it's multithreaded, :D
> >
> >
> > > > 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.
> > > :-)
> >
> > Yes, it's not SO easy, because, as you said, you have to dig into the
> > layers until you hit the actual socket creation and modify the timeout
> > for that socket only.
> >
> > That's why I think that this should be handled in the standard library
> > and not left to implement to whoever will need it, :)
> >
> > --
> > .    Facundo
> >
> > Blog: http://www.taniquetil.com.ar/plog/
> > PyAr: http://www.python.org/ar/
> > _______________________________________________
> > Python-Dev mailing list
> > Python-Dev at python.org
> > http://mail.python.org/mailman/listinfo/python-dev
> > Unsubscribe: http://mail.python.org/mailman/options/python-dev/guido%40python.org
> >
>
>
> --
> --Guido van Rossum (home page: http://www.python.org/~guido/)
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/aleaxit%40gmail.com
>


More information about the Python-Dev mailing list