Message6285
I was responding to a question on c.l.py earlier about
urllib hanging and was reminded of Tim O'Malley's
timeoutsocket.py. It's a shim above socket that allows
you to set timeouts on any TCP connections. Back in
January, Jeff Bauer suggested in c.l.py that it be
included in the core. I agree that it provides useful
extra functionality beyond the current socket
implementation and would like it to be considered for
addition to the standard distribution. Here's a
pointer:
http://www.timo-tasi.org/python/timeoutsocket.py
Here's how you use it:
import timeoutsocket
import httplib
timeoutsocket.setDefaultSocketTimeout(20)
# at this point any sockets created
# will have a 20-second timeout
h = httplib.HTTP("www.python.org")
Pretty simple, huh?
Skip
|
|
| Date |
User |
Action |
Args |
| 2007-08-23 13:56:04 | admin | link | issue457114 messages |
| 2007-08-23 13:56:04 | admin | create | |
|