3

I used 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.

Ram Rachum
  • 84,019
  • 84
  • 236
  • 374

1 Answers1

3
from urllib2 import urlopen, HTTPError

try:
    f = urlopen(url)
except HTTPError, e:
    print(e.read())
Fred Foo
  • 355,277
  • 75
  • 744
  • 836