☰
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.9K
All Categories
0
Incidents
156
Node JS client
40
Go client
793
.Net API client
380
Kite Publisher
537
.Net / VBA / Excel (3rd party)
458
Algorithms and Strategies
998
Java client
1.1K
API clients
404
PHP client
4K
Python client
347
Mobile and Desktop apps
1.4K
Market data (WebSockets)
3.3K
General
In this Discussion
October 28
sujith
Error of invalid expired token
siddharth123
October 27
edited October 27
in
Python client
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.kite.trade:443
DEBUG:urllib3.connectionpool:
https://api.kite.trade:443
"POST /session/token HTTP/11" 403 None
---------------------------------------------------------------------------
TokenException Traceback (most recent call last)
Cell In[12], line 1
----> 1 data = kite.generate_session("eeeeeeeeeeeeeeeeeeeeeee", api_secret="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
File ~\anaconda3\Lib\site-packages\kiteconnect\connect.py:263, in KiteConnect.generate_session(self, request_token, api_secret)
260 h = hashlib.sha256(self.api_key.encode("utf-8") + request_token.encode("utf-8") + api_secret.encode("utf-8"))
261 checksum = h.hexdigest()
--> 263 resp = self._post("api.token", params={
264 "api_key": self.api_key,
265 "request_token": request_token,
266 "checksum": checksum
267 })
269 if "access_token" in resp:
270 self.set_access_token(resp["access_token"])
File ~\anaconda3\Lib\site-packages\kiteconnect\connect.py:865, in KiteConnect._post(self, route, url_args, params, is_json, query_params)
863 def _post(self, route, url_args=None, params=None, is_json=False, query_params=None):
864 """Alias for sending a POST request."""
--> 865 return self._request(route, "POST", url_args=url_args, params=params, is_json=is_json, query_params=query_params)
File ~\anaconda3\Lib\site-packages\kiteconnect\connect.py:937, in KiteConnect._request(self, route, method, url_args, params, is_json, query_params)
935 # native Kite errors
936 exp = getattr(ex, data.get("error_type"), ex.GeneralException)
--> 937 raise exp(data["message"], code=r.status_code)
939 return data["data"]
940 elif "csv" in r.headers["content-type"]:
TokenException: Token is invalid or has expired.
Tagged:
request_token
invalid token
Token invalid or expired
sujith
October 28
This means your session is expired and you need to generate a new access token.
Sign In
or
Register
to comment.