What is the timeout value of HTTP

Alex Martelli aleax at mac.com
Thu Mar 29 17:31:04 CEST 2007

ken <ken.carlino at gmail.com> wrote:

> Can you please tell me what is the timeout value of httplib.HTTP?
> 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()

HTTP per se does not define any timeout -- if self.url is correctly
resolved by DNS and accepts a TCP connection on port 8080, and then just
hangs forever, you'll be waiting.  You can force timeouts yourself by
playing with socket.setdefaulttimeout(...) before you start the HTTP


More information about the Python-list mailing list