☰
Login
Signup
Home
›
Python client
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Register
Categories
Recent Discussions
Activity
Categories
12.1K
All Categories
91
Node JS client
32
Go client
706
.Net API client
339
Kite Publisher
526
.Net / VBA / Excel (3rd party)
402
Algorithms and Strategies
901
Java client
918
API clients
386
PHP client
3.4K
Python client
314
Mobile and Desktop apps
1.2K
Market data (WebSockets)
2.9K
General
In this Discussion
February 2022
anson
February 2022
SRIJAN
Getting token Exception Error
anson
February 2022
in
Python client
generated a new access token and tried the below code I'm getting
{"status":"error","message":"Incorrect `api_key` or `access_token`.","data":null,"error_type":"TokenException"}
headers = {
'X-Kite-Version': '3',
'Authorization': 'token api_key:{}'.format(access_token)
}
response = requests.get('
https://api.kite.trade/trades'
, headers=headers)
print("response", response.text)
SRIJAN
February 2022
edited February 2022
Take your api_key out of quotes. What you have written is literally 'api_key'. It should be actual api_key like 'XXXXXX'. Like this:
headers = {
'X-Kite-Version': '3',
'Authorization': 'token {}:{}'.format(api_key,access_token)
}
anson
February 2022
Thanks
This discussion has been closed.
headers = {
'X-Kite-Version': '3',
'Authorization': 'token {}:{}'.format(api_key,access_token)
}