try:
response = urllib.request.urlopen(url, timeout=10)
except SocketError as e:
if e.errno != errno.ECONNRESET:
raise # Not the error we are looking for
return False
except urllib.error.HTTPError:
return False
except urllib.error.URLError:
return False
except SocketError:
return False
except socket.timeout:
return False
except http.client.BadStatusLine:
return False
except http.client.IncompleteRead:
return False
try:
pass
except Exception as e:
print(e)
Find more questions by tags Python