question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ConnectionError exception from requests not trapped

See original GitHub issue

The 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:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
kbrcommented, Dec 27, 2021

covered with 1.8.0

1reaction
kbrcommented, Dec 23, 2021

Ok, but this is kind of a UserError 😃 Never got this in all the years – however, we can catch this.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found