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

Raymond Hettinger python at rcn.com
Fri Feb 9 06:23:27 CET 2007


[GvR]

I recently needed to access an HTTP URL with a timeout. I ended up monkey-patching httplib.HTTPConnection so that the connect() method has an optional second paramer, timeout, defaulting to None; if not None, a call to settimeout() is added right after successful creation of the socket.

Does anybody else think this is a good idea? (Personally I think this should've been done years ago. :-) Shall I check it into the head?

Yes. This is has been requested more than once, but no one ever got around to adding the timeout..

Raymond



More information about the Python-Dev mailing list