timeout in urllib.open()
Paul Rubin
http
Mon Feb 19 12:51:06 EST 2007
Stefan Palme <kleiner at hora-obscura.de> writes:
> is there a way to modify the time a call of
>
> urllib.open(...)
>
> waits for an answer from the other side? Have a tool which
> automatically checks a list of websites for certain content. The
> tool "hangs" when one of the contacted websites behaves badly and
> "never" answers...
Other than by using socket timeouts, at least in Un*x, you can also
use signal.alarm. You can only have one OS-provided alarm pending at
a time, so if you want multiple overlapping timeouts you have to
schedule them yourself with a single alarm.
More information about the Python-list
mailing list