python-binance
python-binance copied to clipboard
APIError(code=-2015): Invalid API-key, IP, or permissions for action.
I wan to use this lib for sample trade in https://testnet.binancefuture.com/ I use API_KEY and API_SECTERT thats provided in bottom of panel. but when I want do anything like get_account() i get this error i change default client.py base on this link https://github.com/sammchardy/python-binance/pull/578/commits/692992dca2dbbd705d6ffe48921dfae59b6d1375 but problem exist.
same error
did you guys figure it out? I get the same thing
You need to generate API keys through this website and also use the test api url mentioned in this website:
https://testnet.binance.vision/
Here is a small example code snippet on how you can set the API_KEY, API_SECRET and API_URL:
` from binance.client import Client
api_key = 'YOUR-API-KEY' api_secret = 'YOUR-API-SECRET' api_url = 'YOUR-API-URL'
client = Client(api_key, api_secret) client.API_URL = api_url `
Note: Do not insert confidential data directly into the code
for test try this
client = Client(api_key, api_secret)
client.API_URL = "https://testnet.binance.vision/api"
but there must be a better way to convert all api to test
here is the answer, gotta create a testnet api key which is different to the regular api key via the binance testnet docs
https://stackoverflow.com/questions/67376632/how-to-create-binance-test-api-key
https://testnet.binance.vision/ (click generate api)