client-python icon indicating copy to clipboard operation
client-python copied to clipboard

Deprecation warnings with websockets imports

Open furechan opened this issue 11 months ago • 2 comments

Describe the bug

The package gives deprecation warnings on import.

DeprecationWarning: websockets.client.connect is deprecated
DeprecationWarning: websockets.client.WebSocketClientProtocol is deprecated

To Reproduce

from polygon import RESTClient

Additional context All packages installed with uv including websockets version 14.1

The warning comes from the following line in polygon/websocket/__init__.py:

from websockets.client import connect, WebSocketClientProtocol

websockets.client.connect has been deprecated. To be replaced I believe with websockets.connect. WebSocketClientProtocol has also been deprecated.

See websockets upgrade

furechan avatar Jan 11 '25 15:01 furechan

Hey, I'll check this out. Thanks for reporting. What OS/python version are you seeing this on? I'm just wondering since I don't see this on my end but after looking at the docs we can fix regardless.

justinpolygon avatar Jan 15 '25 17:01 justinpolygon

Thanks. I am on MacOS (Apple Silicon), Python Version 3.10, using a uv managed environment. The warnings appear while running some tests with pytest.

furechan avatar Jan 15 '25 23:01 furechan

Hey @furechan, this issue has been addressed in our latest release, v1.16.0. For full details on what's new, check out the release notes.

To upgrade and get the fix:

pip install -U polygon-api-client

I'm closing this issue for now, but feel free to reopen it if the problem persists or if you have more details!

justinpolygon avatar Oct 15 '25 18:10 justinpolygon