Kucoin / kucoin-api-docs

KuCoin API Docs
Other
273 stars 146 forks source link

documentation example gives gateway timeout #377

Open nareto opened 2 years ago

nareto commented 2 years ago

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.

ak3zaidan commented 2 years ago

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 commented 2 years ago

@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)

nareto commented 2 years ago

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

calcifieddeveloper commented 2 years ago

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

LOGOLFGODORD commented 2 years ago

You'll never be in my boat

nareto commented 2 years ago

@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

progressivehed commented 2 years ago

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