What is the timeout value of HTTP
Facundo Batista
facundo at taniquetil.com.ar
Thu Mar 29 13:07:44 EDT 2007
ken wrote:
> i.e. how long python will wait for a response in the below code?
>
> h = httplib.HTTP(self.url, 8080)
> h.putrequest('GET', '/sample/?url=' + self.url)
> h.endheaders()
For ever.
In Py<=2.5, httplib.HTTP doesn't have a timeout, so you have to do
something like:
>>> import socket
>>> socket.setdefaulttimeout(...)
>>> h = httplib.HTTP(...)
Beware that *all* sockets created after the call to setdefaulttimeout()
will have that default.
httplib.HTTP now has a timeout, but in the development trunk (you'll
have to checkout the SVN code and compile Python yourself, or wait until
Py2.6).
Regards,
--
. Facundo
.
Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/
More information about the Python-list
mailing list