I am using Python3 requests module, doing a try/except and catching a timeout error specifically. The except statement returns the exception as a class object. How can I parse out particular elements of the error, for example, the URL? This is Python 3.7.8 on Ubuntu 18.04 if that matters.
try:
result = requests.get(domain, timeout=5)
except requests.exceptions.Timeout as Err:
print(type(Err))
print(Err)
Returns --
<class 'requests.exceptions.ConnectTimeout'>
HTTPSConnectionPool(host='10.10.10.92', port=443): Max retries exceeded with url: /custom.php (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7c16f14f73d1>, 'Connection to 10.10.10.92 timed out. (connect timeout=5)'))
I'd like to be able to grab just the "Max retries exceeded with url: /custom.php" section.