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

fix(xt): websocket token recreated on each watch_ call, causing 429 error #24809

Merged
merged 3 commits into from
Jan 9, 2025

Conversation

danilbogdan
Copy link
Contributor

@danilbogdan danilbogdan commented Jan 8, 2025

During calls of private watch_ methods, The token retrieved from the API was stored as a string in client.subscriptions['token']. However, when attempting to access it, the method self.safe_dict(client.subscriptions, 'token') was used, which expects a dictionary. As a result, it returned None due to the type mismatch, causing another call to ws-token API, which than reaches RateLimitExceeded: 429 Too Many Requests.

The token retrieved from the API was stored as a string in client.subscriptions['token']. However, when attempting to access it, the method self.safe_dict(client.subscriptions, 'token') was used, which expects a dictionary. As a result, it returned None due to the type mismatch, causing issues when calling private API endpoints.
@danilbogdan danilbogdan changed the title Fix Websocket token storage and retrieval fix(xt): websocket is not retrieved from subscriptions dict and recreated each time, causing 429 error Jan 8, 2025
@danilbogdan danilbogdan changed the title fix(xt): websocket is not retrieved from subscriptions dict and recreated each time, causing 429 error fix(xt): websocket token recreated each time, causing 429 error Jan 8, 2025
@danilbogdan danilbogdan changed the title fix(xt): websocket token recreated each time, causing 429 error fix(xt): websocket token recreated on each watch_ call, causing 429 error Jan 8, 2025
@carlosmiei
Copy link
Collaborator

Hello @danilbogdan, thanks for fixing it, we will review and merge it shortly

@carlosmiei carlosmiei merged commit d03fe3e into ccxt:master Jan 9, 2025
2 checks passed
kroitor pushed a commit that referenced this pull request Jan 9, 2025
…rror (#24809)

* Update xt.py

The token retrieved from the API was stored as a string in client.subscriptions['token']. However, when attempting to access it, the method self.safe_dict(client.subscriptions, 'token') was used, which expects a dictionary. As a result, it returned None due to the type mismatch, causing issues when calling private API endpoints.

* fix(xt): token reading

* revert

---------

Co-authored-by: carlosmiei <43336371+carlosmiei@users.noreply.github.com>

[ci skip]
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