Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aiohttp 3.10.0 may have broken ProxyConnector implementation? #43

Closed
vEpiphyte opened this issue Jul 31, 2024 · 2 comments
Closed

aiohttp 3.10.0 may have broken ProxyConnector implementation? #43

vEpiphyte opened this issue Jul 31, 2024 · 2 comments

Comments

@vEpiphyte
Copy link

The happyeyeballs support ( added here aio-libs/aiohttp@1700e9d aio-libs/aiohttp#7954 aio-libs/aiohttp#8005 ) changed the call signature of the TCPConnector._wrap_create_connection function.

Using a proxy like this in aiohttp 3.9.5 would result in a timeout when connecting.

proxy='socks5://user:pass@127.0.0.1:1'  # Example proxy value that would previously timeout connecting
connector = aiohttp_socks.ProxyConnector.from_url(proxy)
async with aiohttp.ClientSession(connector=connector) as sess:
    async with sess.request('GET', url) as resp:
        # do stuff with response

In aiohttp 3.10.0 this now raises a TypeError:

Traceback (most recent call last):
  File "/some/path/file.py", line 1729, in foo
    async with sess.request('GET', url) as resp:
  File "/some/venv/lib/python3.11/site-packages/aiohttp/client.py", line 1344, in __aenter__
    self._resp = await self._coro
                 ^^^^^^^^^^^^^^^^
  File "/some/venv/lib/python3.11/site-packages/aiohttp/client.py", line 648, in _request
    conn = await self._connector.connect(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/some/venv/lib/python3.11/site-packages/aiohttp/connector.py", line 546, in connect
    proto = await self._create_connection(req, traces, timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/some/venv/lib/python3.11/site-packages/aiohttp/connector.py", line 954, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/some/venv/lib/python3.11/site-packages/aiohttp/connector.py", line 1282, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: ProxyConnector._wrap_create_connection() missing 2 required positional arguments: 'host' and 'port'
@romis2012
Copy link
Owner

Fixed in v0.9.0

@vEpiphyte
Copy link
Author

@romis2012 Thanks! I missed that - I thought I had installed the latest aiohttp-socks when I was testing. I'll go ahead and close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants