Tinkoff / invest-python

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

[Bug] await 2 раза на одну корутину #82

Closed Maksim787 closed 2 years ago

Maksim787 commented 2 years ago

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

Убрать await в строчке https://github.com/Tinkoff/invest-python/blob/26ef8cc1e70d144707246e64f29466b4491d4f8c/tinkoff/invest/async_services.py#L598

instruments.get_favorites() выдает ошибку TypeError: object GetFavoritesResponse can't be used in 'await' expression

Корутина ожидается дважды:

@handle_aio_request_error("GetFavorites")
    async def get_favorites(
        self,
    ) -> GetFavoritesResponse:
        request = GetFavoritesRequest()
        response_coro = await self.stub.GetFavorites(
            request=_grpc_helpers.dataclass_to_protobuff(
                request, instruments_pb2.GetFavoritesRequest()
            ),
            metadata=self.metadata,
        )
        response = await response_coro
        log_request(await get_tracking_id_from_coro(response_coro), "GetFavorites")
        return _grpc_helpers.protobuf_to_dataclass(response, GetFavoritesResponse)

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

No response

Tinkoff Invest Version

0.2.0-beta30

Python Version

3.10

OS

Windows

Логи

No response

irusland commented 2 years ago

Fixed in https://github.com/Tinkoff/invest-python/pull/88