kucoin-api-docs icon indicating copy to clipboard operation
kucoin-api-docs copied to clipboard

documentation example gives gateway timeout

Open nareto opened this issue 3 years ago • 7 comments

I created a new v2 key with "General" and "Trade" restrictions and I'm trying to run the python code from the first example in the documentation:

  #Example for get balance of accounts in python

  api_key = "<my_api_key>"
  api_secret = "<my_api_secret>"
  api_passphrase = "<my_api_passphrase>"
  url = 'https://openapi-sandbox.kucoin.com/api/v1/accounts'
  now = int(time.time() * 1000)
  str_to_sign = str(now) + 'GET' + '/api/v1/accounts'
  signature = base64.b64encode(
      hmac.new(api_secret.encode('utf-8'), str_to_sign.encode('utf-8'), hashlib.sha256).digest())
  passphrase = base64.b64encode(hmac.new(api_secret.encode('utf-8'), api_passphrase.encode('utf-8'), hashlib.sha256).digest())
  headers = {
      "KC-API-SIGN": signature,
      "KC-API-TIMESTAMP": str(now),
      "KC-API-KEY": api_key,
      "KC-API-PASSPHRASE": passphrase,
      "KC-API-KEY-VERSION": "2"
  }
  response = requests.request('get', url, headers=headers)
  print(response.status_code)
  print(response.json())

However I am getting in response a 504 code and a webpage with the content posted below. I've been trying this since yesterday with no change. Can somebody help me or point me in the right direction?

Gateway time-out

You

Browser

Working Milan

Cloudflare

Working openapi-sandbox.kucoin.com

Host

Error

What happened?

The web server reported a gateway time-out error.

What can I do?

Please try again in a few minutes.

nareto avatar Apr 12 '22 09:04 nareto

I have been trying to do the same thing @nareto and ive been getting the same error also. Do you know the fix? If you find out please let me know

ak3zaidan avatar Apr 13 '22 00:04 ak3zaidan

@nareto I found out the fix to this. To get account data do this step 1: pip install kucoin-python

step 2: from kucoin.client import User

step 3: client = User(api_key, api_secret, api_passphrase) accounts = client.get_account_list() print(accounts)

ak3zaidan avatar Apr 14 '22 02:04 ak3zaidan

Thanks @ak3zaidan but this is just a workaround. I'm getting the same gateway timeout issue on other endpoints as well and I do not want to depend on further libraries

nareto avatar Apr 14 '22 09:04 nareto

@nareto : I'm in the same boat. Did you manage to find a solution ?

calcifieddeveloper avatar Apr 25 '22 00:04 calcifieddeveloper

You'll never be in my boat

LOGOLFGODORD avatar Apr 25 '22 01:04 LOGOLFGODORD

@calcifieddeveloper not really. I opened a ticket on Kucoin and got put in contact with somebody on Telegram, who said something like the sandbox is not working or not supposed to. I even linked him to this issue, so they know it's here

nareto avatar Apr 28 '22 13:04 nareto

Hello every one.

Thanks for bringing this subject. Thsi is Hed, from API group.

The error you're getting (504 code) is coming from the Sandbox unstability and Network connection.

Please try by reseting and refreshing your connection or using a VPN and try again. If the problem was still there, infrom Admins in API Telegram Group

progressivehed avatar May 19 '22 01:05 progressivehed