Skip to content

Commit 68dff9f

Browse files
authored
[PYAQMP] Fix Deprecation Warning for Async WS (#40441)
* use timeout class for aiohttp to avoid deprecation msg * update changelog
1 parent 52c99e1 commit 68dff9f

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

sdk/eventhub/azure-eventhub/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
- Added support for handling a C# DateTime.MinValue timestamp, which is returned by the service as a sentinel for time which is not set.
1818
- Deprecating `uamqp_transport` in favor of pyAMQP transport. The `uamqp_transport` will be removed in the next minor release.
19+
- Fixed aiohttp websocket library showing a deprecation warning due to an incorrect timeout type ([#40429](https://github.com/Azure/azure-sdk-for-python/issues/40429))
1920
- Dropped support for Python 3.8
2021
- The following change has been temporarily pulled out and will be added to a future release:
2122
- Implemented a new websockets library so that using `AmqpOverWebsocket` no longer requires separate optional dependency installations.

sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/aio/_transport_async.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ async def connect(self):
438438
from aiohttp import ( # pylint: disable=networking-import-outside-azure-core-transport
439439
ClientSession,
440440
ClientConnectorError,
441+
ClientWSTimeout,
441442
)
442443
from urllib.parse import urlsplit
443444
except ImportError:
@@ -466,7 +467,7 @@ async def connect(self):
466467

467468
self.sock = await self.session.ws_connect(
468469
url=url,
469-
timeout=self.socket_timeout, # timeout for connect
470+
timeout=ClientWSTimeout(ws_close=self.socket_timeout),
470471
protocols=[AMQP_WS_SUBPROTOCOL],
471472
autoclose=False,
472473
proxy=http_proxy_host,

sdk/servicebus/azure-servicebus/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
- Added support for handling a C# DateTime.MinValue timestamp, which is returned by the service as a sentinel for time which is not set.
1212
- Deprecating `uamqp_transport` in favor of pyAMQP transport. The `uamqp_transport` will be removed in the next minor release.
13+
- Fixed aiohttp websocket library showing a deprecation warning due to an incorrect timeout type ([#40429](https://github.com/Azure/azure-sdk-for-python/issues/40429))
1314
- Dropped support for Python 3.8
1415

1516
## 7.14.1 (2025-03-12)

sdk/servicebus/azure-servicebus/azure/servicebus/_pyamqp/aio/_transport_async.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ async def connect(self):
438438
from aiohttp import ( # pylint: disable=networking-import-outside-azure-core-transport
439439
ClientSession,
440440
ClientConnectorError,
441+
ClientWSTimeout,
441442
)
442443
from urllib.parse import urlsplit
443444
except ImportError:
@@ -466,7 +467,7 @@ async def connect(self):
466467

467468
self.sock = await self.session.ws_connect(
468469
url=url,
469-
timeout=self.socket_timeout, # timeout for connect
470+
timeout=ClientWSTimeout(ws_close=self.socket_timeout),
470471
protocols=[AMQP_WS_SUBPROTOCOL],
471472
autoclose=False,
472473
proxy=http_proxy_host,

0 commit comments

Comments
 (0)