ConnectionError exception from requests not trapped
See original GitHub issueThe following trace should be catch and should be catch and raised as FritzConnectionException
.
Reference trace:
File "/usr/local/lib/python3.9/site-packages/fritzconnection/core/fritzconnection.py", line 155, in __init__
self.device_manager.add_description(source)
File "/usr/local/lib/python3.9/site-packages/fritzconnection/core/devices.py", line 75, in add_description
root = get_xml_root(source, timeout=self.timeout, session=self.session)
File "/usr/local/lib/python3.9/site-packages/fritzconnection/core/utils.py", line 59, in get_xml_root
source = get_content_from(source, timeout=timeout, session=session)
File "/usr/local/lib/python3.9/site-packages/fritzconnection/core/utils.py", line 41, in get_content_from
with session.get(url, timeout=timeout) as response:
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 555, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.1.3', port=49000): Max retries exceeded with url: /igddesc.xml (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fad67c1c0>: Failed to establish a new connection: [Errno 113] Host is unreachable'))
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
how to solve requests.exceptions.ConnectionError in python ...
I mean the script should get stuck at that request statement until it get response from the url. – Roman K.C.
Read more >requests.exceptions.ConnectionError · Issue #3970 - GitHub
works fine in python shell but not in python manage.py shell (django) I am getting below error 'requests.exceptions.ConnectionError: ...
Read more >How To Handle Errors & Exceptions with Requests and Python
Learning how to raise and handle your exceptions properly in Python is an extremely useful skill especially when paired with good logging.
Read more >how to handle python requests.exceptions.ConnectionError
how to handle python requests. exceptions.ConnectionErrorwhen trying to requests.get() but you don't have internet so it raised an ...
Read more >Handling Timeouts with Python Requests - Majornetwork
By default it doesn't define any timeouts for the operations. It means that in specific circumstances a simple requests.get() call might not ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
covered with 1.8.0
Ok, but this is kind of a UserError 😃 Never got this in all the years – however, we can catch this.