From b00abd0e51d80328f6fda0678f63eac0666f1664 Mon Sep 17 00:00:00 2001 From: jaredgoldman Date: Thu, 13 Apr 2023 21:48:17 -0400 Subject: [PATCH] Add a fail case ws token request --- piker/brokers/kucoin.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/piker/brokers/kucoin.py b/piker/brokers/kucoin.py index ff891f96..39cd666c 100644 --- a/piker/brokers/kucoin.py +++ b/piker/brokers/kucoin.py @@ -258,9 +258,13 @@ class Client: ''' token_type = 'private' if private else 'public' - data: dict[str, Any] | None = await self._request( - 'POST', f'/bullet-{token_type}', 'v1' - ) + try: + data: dict[str, Any] | None = await self._request( + 'POST', f'/bullet-{token_type}', 'v1' + ) + except Exception as e: + log.error(f'Error making request for Kucoin ws token -> {str(e)}') + return None if data and 'token' in data: # ping_interval is in ms @@ -271,6 +275,7 @@ class Client: f'Error making request for Kucoin ws token -> {data.json()["msg"]}' ) + async def _get_pairs( self, ) -> dict[str, KucoinMktPair]: