I am getting an exception on an HTTP GET request (http.client.HTTPConnection.getresponse), but so far have been unable to determine the nature of the exception (my Python is fairly rudimentary). The code looks like this:
try:
r = conn.getresponse()
except Exception as x:
logger.error('Error getting data:' + str(x))
This just results in logs looking like Error getting data:''. I could trap all the different types of exception that HTTPConnection.getresponse can raise, but that seems ridiculous given there are so many possible exception types and I'm just trying to debug how the connection is failing. Is there a way to inspect the exception object?
type(x)or for a full trace, passexc_info=Trueinto that log statement