kiteconnect.exceptions.TokenException: Token is invalid or has expired.

vibhavachar
EBUG:urllib3.connectionpool:Starting new HTTP connection (1): 127.0.0.1:43457
DEBUG:urllib3.connectionpool:http://127.0.0.1:43457 "DELETE /session/1bfa260c4f874f32ec4ff45422ba8c71 HTTP/1.1" 200 14

DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.kite.trade:443
DEBUG:urllib3.connectionpool:https://api.kite.trade:443 "POST /session/token HTTP/1.1" 403 None
Traceback (most recent call last):
File "access_token_ec2.py", line 106, in
data = kite.generate_session(request_token, api_secret=key_secret[1])
File "/home/ec2-user/anaconda3/envs/algov5/lib/python3.7/site-packages/kiteconnect/connect.py", line 260, in generate_session
"checksum": checksum
File "/home/ec2-user/anaconda3/envs/algov5/lib/python3.7/site-packages/kiteconnect/connect.py", line 840, in _post
return self._request(route, "POST", url_args=url_args, params=params, is_json=is_json, query_params=query_params)
File "/home/ec2-user/anaconda3/envs/algov5/lib/python3.7/site-packages/kiteconnect/connect.py", line 912, in _request
raise exp(data["message"], code=r.status_code)
kiteconnect.exceptions.TokenException: Token is invalid or has expired.
  • vibhavachar
    File "access_token_ec2.py", line 110, in
    data = kite.generate_session(request_token, api_secret=key_secret[1])
    File "/home/ec2-user/anaconda3/envs/algov5/lib/python3.7/site-packages/kiteconnect/connect.py", line 260, in generate_session
    "checksum": checksum
    File "/home/ec2-user/anaconda3/envs/algov5/lib/python3.7/site-packages/kiteconnect/connect.py", line 840, in _post
    return self._request(route, "POST", url_args=url_args, params=params, is_json=is_json, query_params=query_params)
    File "/home/ec2-user/anaconda3/envs/algov5/lib/python3.7/site-packages/kiteconnect/connect.py", line 912, in _request
    raise exp(data["message"], code=r.status_code)
    kiteconnect.exceptions.TokenException: Token is invalid or has expired.
  • vibhavachar
    Now gettiing the above error, after modifying my python client, able to get the correct token now.
This discussion has been closed.