How would I go about checking if urllib2 timed out?

Lamonte Harris pyth0nc0d3r at gmail.com
Tue Apr 8 20:31:59 EDT 2008


Can someone explain to me how I would do error handling to check if the
current proxy timed out on when trying to connect to the web page:

import urllib2
proxy=urllib2.ProxyHandler({'http':'24.232.167.22:80'})
opener=urllib2.build_opener(proxy)
f=opener.open('http://www.whatismyipaddress.com'
<http://www.whatismyipaddress.com%27/>)
print f.read()

If someone could help me, thank you very much, I'm still very new to error
handling
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080408/c09c8f4b/attachment.html>


More information about the Python-list mailing list