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

KeyError: 'error' in TonCenterClient in case of an error "Ratelimit exceed" #20

Open
QuisEgoSum opened this issue Jul 24, 2024 · 1 comment

Comments

@QuisEgoSum
Copy link

Traceback (most recent call last):
  File "<rootDir>/gdfgsdg.py", line 25, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "<rootDir>/gdfgsdg.py", line 19, in main
    print(await wallet.run_get_method('get_wallet_data', []))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/quisegosum/Project/bets/toncoin/.venv/lib/python3.11/site-packages/TonTools/Contracts/Contract.py", line 151, in run_get_method
    return await self.provider.run_get_method(method=method, address=self.address, stack=stack)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/quisegosum/Project/bets/toncoin/.venv/lib/python3.11/site-packages/TonTools/Providers/TonCenterClient.py", line 98, in run_get_method
    response = await process_response(response)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/quisegosum/Project/bets/toncoin/.venv/lib/python3.11/site-packages/TonTools/Providers/TonCenterClient.py", line 34, in process_response
    raise TonCenterClientError(f'TonCenter failed with error: {response_dict["error"]}')
                                                               ~~~~~~~~~~~~~^^^^^^^^^
KeyError: 'error'

Response from API:

{'ok': False, 'result': 'Ratelimit exceed', 'code': 429}
@SerhiiL06
Copy link

A rate limit error means that you are making too many requests to the toncenter api. just increase the request interval (one second is enough) and everything will work.

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

No branches or pull requests

2 participants