Getting Token is expired /invalid

Sonia
this is my small code. Wa sable to generate request token . please note in this screen shot I have hided my api_key and other details however, when running this small code why I am keep on receiving Token is invalid/expired
Can some one please check on this? Why I generated token once it should be valid File "/Users/sanam/Library/Python/3.9/lib/python/site-packages/kiteconnect/connect.py", line 263, in generate_session
resp = self._post("api.token", params={
File "/Users/sanam/Library/Python/3.9/lib/python/site-packages/kiteconnect/connect.py", line 865, in _post
return self._request(route, "POST", url_args=url_args, params=params, is_json=is_json, query_params=query_params)
File "/Users/sanam/Library/Python/3.9/lib/python/site-packages/kiteconnect/connect.py", line 937, in _request
raise exp(data["message"], code=r.status_code)
kiteconnect.exceptions.TokenException: Token is invalid or has expired.
sanam@sanam-MacBook-Pro pykiteconnect %
  • Nivas
    You should not request an access token for every run. Once you get an access token, store it and reuse it. You can check out a similar discussion here.
  • Sonia
    Many Thanks for replying @Nivas .. Same thought process went in my mind but did not help. checking link.
Sign In or Register to comment.