-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid status code 400 when trying to get account info #14
Comments
Hi, this error indicates that there is no correct key-related information. First, please check if the key information is correct. Your example code is incomplete, and I can’t see specifically which method under account_api was called. Please provide more context, and I’ll help you resolve the issue. |
Thank you for your response. The code I posted before is picked from the examples. I tried getting the account_api and print the account information. The file name is example_api.py. https://github.com/Kucoin/kucoin-universal-sdk/blob/main/sdk/python/example/example_api.py (line 73) Do I need to add the signature and timestamp separately or the api does it for us?
|
Hi, As a client, you only need to set the necessary keys. Other parameters, such as the signature and timestamp you mentioned, don’t need to be set manually. I ran the code again based on your input and didn’t find any issues. Here’s the output:
I have my keys set in environment variables like this:
Your issue is most likely due to incorrect key/secret/passphrase configuration. Please check them on the KuCoin official website. If you still encounter any issues, please let me know promptly. |
I verified my api key and secret and have tried accessing data from kucoin. I copied the program as is and then updated my api keys and tried to execute the code. I am still getting same issue. I am able to create spot service and get the ohclv data, get trade history etc. But I did notice one more thing.. It saying API token is empty does this have anything to do with the api keys ? `2025-02-21 20:09:14 INFO - sdk version: v1.1.0 Rest of the error is same. I am assuming I dont need broker information which is present in the above code. I have removed that part. Can you please guide me on this? |
I am a newbie and this may be a simple thing. I was not able to get a satisfactory answer anywhere and also code I am getting is for the older sdk which is deprecated, so I am posting it here. I am getting following error when I try to get account information.
/myenv/lib/python3.11/site-packages/kucoin_universal_sdk/internal/infra/default_transport.py", line 184, in process_response raise RestError(None, f"Invalid status code: {resp.status_code}, msg: {resp_body.decode('utf-8')}") kucoin_universal_sdk.model.common.RestError: request error, context msg: Invalid status code: 400, msg: {"code":"400001","msg":"Please check the header of your request for KC-API-KEY, KC-API-SIGN, KC-API-TIMESTAMP, KC-API-PASSPHRASE"}
When we create transport option and Client option with the api key, secret and pass phrase should it not return account info as it has all the required details. My code is as below:
Do we need to separately sign and return timestamp for the request?
The text was updated successfully, but these errors were encountered: