How to handle timed out connections
Lars Hoeyrup Jensen
robinhat at rhk.dk
Sat Mar 11 10:08:44 EST 2000
I have a program that tries to connect to a certain web page with
urlopen(). Sometimes the page doesn't respond: if I try to open it in
Netscape, after a couple of minutes I get a message like this:
"ERROR
The requested URL could not be retrieved
.....
(110) Connection timed out
...
Generated by .... (Squid/2.2.STABLE4)"
How do I handle this in Python? I would like to generate a message
like "The page is currently down" or something if the page doesn't
respond, but I don't know how to "detect" this timeout in Python.
Thanks in advance,
Lars
More information about the Python-list
mailing list