Closed priyen closed 6 years ago
Hi @priyen I can't see any documentation around that issue.
Are you able to give me an example of the code you're using?
ending_kucoin_ltc = client_kucoin.get_coin_balance('LTC')['balance'] ending_kucoin_eth = client_kucoin.get_coin_balance('ETH')['balance']
The call works the first time, then keeps getting unauth unless I reinstantiate a new client
Hi @priyen from my investigation it seems the Kucoin API response times are inconsistent.
Responses that take longer than 10 seconds return a 504 gateway timeout message that I need to handle properly. Response that take between 6 and 10 seconds return the UNAUTH: Invalid nonce error.
If the response returns in the less than 6 seconds then it works properly.
So at the moment the only fix may be retrying the request.
Hi @sammchardy , I would like to use this issue to ask about the exceptions. What is the best way to get the exception failure name, I mean in a proper case we could have UNAUTH, Not found and others exceptions, so how you would catch the name of the exception or the specific point of failure. For example in the following code we have a try and except block, the idea is to print the exception name(UNAUTH, Not Found..etc)
try:
client = ClientK(api_key.strip(), api_secret.strip())
infouser = client.get_user() #in order to test the api connection with the API
except KucoinAPIException:
print('your exception was due to{}'.format(varexplanation) )
What would be the best option, because I would like to show a message with the failure but no all.
Hi @h3ct0rjs update your code like this so the exception is set as a variable
try:
client = ClientK(api_key.strip(), api_secret.strip())
infouser = client.get_user() #in order to test the api connection with the API
except KucoinAPIException as e:
print('your exception was due to{}'.format(e) )
print('error code'.format(e.code) ) # UNAUTH
print('error message'.format(e.message) ) # Not Found
The e variable is then of type KucoinAPIException and that has properties
Thank you so much :)
Hi, I keep getting the above exception while trying to do recurring balance calls. It happens after a minute or so but It seems really random. Im not sure how to fix it