From 3b88e61a3386d2f267d576d7342d20b102490353 Mon Sep 17 00:00:00 2001 From: Thomas Hahn Date: Sun, 17 Nov 2024 17:10:13 +0100 Subject: [PATCH] Use legacy websockets client --- src/homematicip/aio/connection.py | 4 ++-- tests/aio_tests/test_connection.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/homematicip/aio/connection.py b/src/homematicip/aio/connection.py index 3178d0fe..a3670ee7 100644 --- a/src/homematicip/aio/connection.py +++ b/src/homematicip/aio/connection.py @@ -6,7 +6,7 @@ import aiohttp import async_timeout -import websockets +from websockets.legacy.client import connect from websockets import ConnectionClosed from homematicip.base.base_connection import ( @@ -112,7 +112,7 @@ async def api_call(self, path, body=None, full_url=False): async def _connect_to_websocket(self): try: self.socket_connection = await asyncio.wait_for( - websockets.connect( + connect( self._urlWebSocket, extra_headers={ ATTR_AUTH_TOKEN: self._auth_token, diff --git a/tests/aio_tests/test_connection.py b/tests/aio_tests/test_connection.py index e8f3eff0..be685b74 100644 --- a/tests/aio_tests/test_connection.py +++ b/tests/aio_tests/test_connection.py @@ -40,7 +40,7 @@ async def serve(self): self._add_route() self.runner = web.AppRunner(self.app) await self.runner.setup() - site = web.TCPSite(self.runner, "127.0.0.1", 8123) + site = web.TCPSite(self.runner, "127.0.0.1", 34567) await site.start() pass @@ -133,7 +133,7 @@ async def single_message_server(): @pytest.fixture async def client_connection(event_loop): connection = AsyncConnection(event_loop) - connection._urlWebSocket = "ws://localhost:8123/" + connection._urlWebSocket = "ws://localhost:34567/" connection.ping_timeout = 1 yield connection