I receive a \'HTTP Error 500: Internal Server Error\' response, but I still want to read the data inside the error HTML.
With Python 2.6, I normally fetch a page usi
The HTTPError is a file-like object. You can catch it and then read its contents.
HTTPError
read
try: resp = urllib2.urlopen(url) contents = resp.read() except urllib2.HTTPError, error: contents = error.read()