Add a fail case ws token request

small_kucoin_fixes
jaredgoldman 2023-04-13 21:48:17 -04:00
parent 52a015d927
commit b00abd0e51
1 changed files with 8 additions and 3 deletions
piker/brokers

View File

@ -258,9 +258,13 @@ class Client:
''' '''
token_type = 'private' if private else 'public' token_type = 'private' if private else 'public'
try:
data: dict[str, Any] | None = await self._request( data: dict[str, Any] | None = await self._request(
'POST', f'/bullet-{token_type}', 'v1' '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: if data and 'token' in data:
# ping_interval is in ms # ping_interval is in ms
@ -271,6 +275,7 @@ class Client:
f'Error making request for Kucoin ws token -> {data.json()["msg"]}' f'Error making request for Kucoin ws token -> {data.json()["msg"]}'
) )
async def _get_pairs( async def _get_pairs(
self, self,
) -> dict[str, KucoinMktPair]: ) -> dict[str, KucoinMktPair]: