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

chore: Incompatibility with websockets 14 #657

Merged
merged 1 commit into from
Nov 26, 2024

Conversation

gnought
Copy link
Contributor

@gnought gnought commented Nov 24, 2024

Temporary workaround to pin websocket <14, as v14 updates the connect() api.
https://websockets.readthedocs.io/en/stable/howto/upgrade.html#arguments-of-connect

async with websockets.connect(self._ws_params.socket_url, extra_headers=self._ws_params.headers,

error

future: <Task finished name='Task-40' coro=<Transport._socket() done, defined at /.venv/lib/python3.12/site-packages/fastf1/signalr_aio/transports/_transport.py:81> exception=TypeError("BaseEventLoop.create_connection() got an unexpected keyword argument 'extra_headers'")>"}
2024-11-23T14:19:30.119+08:00
Traceback (most recent call last):
2024-11-23T14:19:30.119+08:00
File "/.venv/lib/python3.12/site-packages/fastf1/signalr_aio/transports/_transport.py", line 82, in _socket
2024-11-23T14:19:30.119+08:00
async with websockets.connect(self._ws_params.socket_url, extra_headers=self._ws_params.headers,
2024-11-23T14:19:30.119+08:00
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-23T14:19:30.119+08:00
File "/.venv/lib/python3.12/site-packages/websockets/asyncio/client.py", line 485, in __aenter__
2024-11-23T14:19:30.119+08:00
return await self
2024-11-23T14:19:30.119+08:00
^^^^^^^^^^
2024-11-23T14:19:30.119+08:00
File "/.venv/lib/python3.12/site-packages/websockets/asyncio/client.py", line 442, in __await_impl__
2024-11-23T14:19:30.119+08:00
self.connection = await self.create_connection()
2024-11-23T14:19:30.119+08:00
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-23T14:19:30.119+08:00
File "/.venv/lib/python3.12/site-packages/websockets/asyncio/client.py", line 368, in create_connection
2024-11-23T14:19:30.119+08:00
_, connection = await loop.create_connection(factory, **kwargs)
2024-11-23T14:19:30.119+08:00
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-23T14:19:30.119+08:00
TypeError: BaseEventLoop.create_connection() got an unexpected keyword argument 'extra_headers'

@theOehrly
Copy link
Owner

Thanks for noticing this. As you say, this would be a temporary solution. Do you have a suggestion for how to fix this properly?

@gnought
Copy link
Contributor Author

gnought commented Nov 25, 2024

Not yet, as least we could have a workaround first to make the project functional.
We should update the websockets dependency >=13 when a fix is ready.

@theOehrly theOehrly merged commit 359144e into theOehrly:master Nov 26, 2024
10 checks passed
@gnought gnought deleted the fix/pin_websocket branch November 27, 2024 18:07
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

Successfully merging this pull request may close these issues.

2 participants