util.make_aiohttp_session: wrap aiohttp-socks 0.11+ excs to ClientError#10733
Merged
Conversation
Member
|
Tested with exchange rate fetching logic. Works and seems reasonable: |
SomberNight
commented
Jul 2, 2026
Comment on lines
+66
to
+71
| try: | ||
| from aiohttp_socks import ProxyConnectionError, ProxyTimeoutError, ProxyError | ||
| except ImportError: # above requires aiohttp_socks>=0.11 | ||
| class _FakeProxyError(Exception): | ||
| pass | ||
| ProxyConnectionError = ProxyTimeoutError = ProxyError = _FakeProxyError |
Member
Author
There was a problem hiding this comment.
note: actually older aiohttp_socks just imports and re-exports the same names from python_socks:
https://github.com/romis2012/aiohttp-socks/blob/v0.9.2/aiohttp_socks/__init__.py#L4-L8
acb3efd to
5ef3d22
Compare
older versions of aiohttp-socks and python-socks used to raise - ProxyConnectionError(OSError) - ProxyTimeoutError(TimeoutError) - ProxyError(Exception) now they raise: - ProxyConnectionError(Exception) - ProxyTimeoutError(Exception) - ProxyError(Exception) In many call sites, we currently handle OSError and TimeoutError, usually by simply logging the error or showing it to the user. Another exceptions our call sites handle similarly is aiohttp.ClientError, which is the aiohttp base class for any client connection error. A simple "fix" for us to restore the old behaviour is converting the new aiohttp_socks exception types to aiohttp.ClientError. ref romis2012/aiohttp-socks@db4235c ref romis2012/python-socks@50a3024
5ef3d22 to
cd68b41
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
older versions of aiohttp-socks and python-socks used to raise
now they raise:
In many call sites, we currently handle OSError and TimeoutError, usually by simply logging the error or showing it to the user. Another exceptions our call sites handle similarly is aiohttp.ClientError, which is the aiohttp base class for any client connection error.
A simple "fix" for us to restore the old behaviour is converting the new aiohttp_socks exception types to aiohttp.ClientError.
ref romis2012/aiohttp-socks@db4235c
ref romis2012/python-socks@50a3024
related:
#10727 (comment) (LLM output:)