requests and urllib333 exceptions adventures
If I’m looking at this, the tenacity library post for retrying may be relevant as well (todo link).
So, TIL:
- urllib3’s ConnectionError is now called ProtocolError, but aliased for backward compatibility
- requests has also a ConnectionError! A totally different one I think
from requests.exceptions import ConnectionError, HTTPError
from urllib3.exceptions import ProtocolError, NameResolutionError, MaxRetryError
- urllib3
- ProtocolError
- RemoteDisconnected
- NameResolutionError - usually temporary
- MaxRetryError
- ProtocolError
- requests:
- ConnectionError - catchall for all of the above?
- HTTPError - 404 and friends
requests
exceptions docs: Developer Interface — Requests 2.31.0 documentation
urllib3
exceptions: Exceptions and Warnings - urllib3 2.1.0 documentation
TODO: Interaction between MaxRetryError <-> other urllib3 errors - who raises whom, and what does requests do with it (I think raising a ConnectionError but am not sure)
Nel mezzo del deserto posso dire tutto quello che voglio.
comments powered by Disqus