☰
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
13.8K
All Categories
0
Incidents
153
Node JS client
40
Go client
793
.Net API client
378
Kite Publisher
537
.Net / VBA / Excel (3rd party)
457
Algorithms and Strategies
993
Java client
1.1K
API clients
404
PHP client
4K
Python client
346
Mobile and Desktop apps
1.4K
Market data (WebSockets)
3.3K
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)
}