Getting the error text from `urllib2.urlopen`
I us开发者_StackOverflow中文版ed Python's urllib2.urlopen
and got a 500 error from the server. How do I find the text of the error? I'm hoping that it has useful information.
from urllib2 import urlopen, HTTPError
try:
f = urlopen(url)
except HTTPError, e:
print(e.read())
精彩评论