[Tutor] urllib2.urlopen()

Ray Jones crawlzone at gmail.com
Sun Oct 14 01:44:30 CEST 2012


I am attempting to capture url headers and have my script make decisions
based on the content of those headers.

Here is what I am using in the relative portion of my script:

try:
    urllib2.urlopen('http://myurl.org')
except urllib2.HTTPError, e:

In the case of authentication error, I can print e.info() and get all
the relevant header information. But I don't want to print. I want the
information from the instance available to use in my script. How do I
accomplish that?


Ray


More information about the Tutor mailing list