I have this code:
try:
self.client.post(url, data, self.cookies, headers, auth, jsonrpc)
self.status = self.client.status
self.mytime = self.client.time
self.text = self.client.text
self.length = len(self.text)
except urllib2.URLError, error:
print error
self.exception = True
self.urrlib2 = True
if isinstance(error.reason, socket.timeout):
self.timeout = True
But sometimes I get exceptions printing out like this:
URLError in POST > reason=The read operation timed out > <urlopen error The read operation timed out>
These are handled by the except urllib2.URLError
. They should pass the if isinstance(error.reason, socket.timeout)
test, but they do not.
So I would like to know what instance
this exception is. How can I do this?