I\'m catching and printing Python Requests ConnectionErrors fine with just this:
except requests.exceptions.ConnectionError as e:
logger.warning(str(e.messag
I had troubles getting the same results with python 3.6 and requests 2.18. I managed to get the errno using the http
and socket
modules :
import socket, html
try:
http.client.HTTPConnection('invalid').connect()
except (socket.gaierror, ConnectionError) as e:
print(e.errno)
Hopefully it helps someonelse.