Tinkoff / invest-python

Tinkoff Invest Python gRPC client
https://tinkoff.github.io/invest-python/
Apache License 2.0
313 stars 90 forks source link

[Bug] Received message larger than max (4240697 vs. 4194304) #225

Closed bkoddo closed 1 year ago

bkoddo commented 1 year ago

Что случилось?

Добрый день! Метод client.instruments.options().instruments падает в ошибку "Received message larger than max (4269209 vs. 4194304)". Python. Официальный SDK.

tracking_id='644e9c0ebc7985f4be465d3777ee87f5'

Воспроизведение


import os

from tinkoff.invest import Client

TOKEN = os.environ["INVEST_TOKEN"]

def main():
    with Client(TOKEN) as client:
        r = client.instruments.options()
        for i in r.instruments:
            print(i)

if __name__ == "__main__":
    main()

Tinkoff Invest Version

0.2.0-beta54

Python Version

3.11

OS

Windows

Логи

Лог:

C:\Users\bkodd\PycharmProjects\pythonProjectMarketMaker\venv\Scripts\python.exe C:\Users\bkodd\PycharmProjects\pythonProjectMarketMaker\main.py 
644e9c0ebc7985f4be465d3777ee87f5 Options RESOURCE_EXHAUSTED Received message larger than max (4240697 vs. 4194304)
Traceback (most recent call last):
  File "C:\Users\bkodd\PycharmProjects\pythonProjectMarketMaker\venv\Lib\site-packages\tinkoff\invest\_errors.py", line 23, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\bkodd\PycharmProjects\pythonProjectMarketMaker\venv\Lib\site-packages\tinkoff\invest\services.py", line 591, in options
    response, call = self.stub.Options.with_call(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\bkodd\PycharmProjects\pythonProjectMarketMaker\venv\Lib\site-packages\grpc\_channel.py", line 1043, in with_call
    return _end_unary_response_blocking(state, call, True, None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\bkodd\PycharmProjects\pythonProjectMarketMaker\venv\Lib\site-packages\grpc\_channel.py", line 910, in _end_unary_response_blocking
    raise _InactiveRpcError(state)  # pytype: disable=not-instantiable
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
    status = StatusCode.RESOURCE_EXHAUSTED
    details = "Received message larger than max (4240697 vs. 4194304)"
    debug_error_string = "UNKNOWN:Error received from peer invest-public-api.tinkoff.ru {grpc_message:"Received message larger than max (4240697 vs. 4194304)", grpc_status:8, created_time:"2023-04-30T16:49:18.557826867+00:00"}"
>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\bkodd\PycharmProjects\pythonProjectMarketMaker\main.py", line 479, in <module>
    main()
  File "C:\Users\bkodd\PycharmProjects\pythonProjectMarketMaker\main.py", line 67, in main
    marketmaker_buy()
  File "C:\Users\bkodd\PycharmProjects\pythonProjectMarketMaker\main.py", line 98, in marketmaker_buy
    instruments = client.instruments.options().instruments
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\bkodd\PycharmProjects\pythonProjectMarketMaker\venv\Lib\site-packages\tinkoff\invest\_errors.py", line 41, in wrapper
    raise RequestError(status_code, details, metadata) from e
tinkoff.invest.exceptions.RequestError: (<StatusCode.RESOURCE_EXHAUSTED: (8, 'resource exhausted')>, 'Received message larger than max (4240697 vs. 4194304)', Metadata(tracking_id='644e9c0ebc7985f4be465d3777ee87f5', ratelimit_limit='200, 200;w=60', ratelimit_remaining=194, ratelimit_reset=42, message=None))

Process finished with exit code 1
irusland commented 1 year ago

Здравствуйте! Попрошу в следующий раз в поле Воспроизведение прикладывать код воспроизводящий проблему. Логи, соответственно, прикладывать в поле Логи

irusland commented 1 year ago

duplicate of https://github.com/Tinkoff/invest-python/issues/198