Token Invalid / Expired

nirmalthomas26
nirmalthomas26 edited February 2018 in General
I have a Python Script which uses KiteConnect API to execute some trade based on a strategy for a user. After a request token is generated, the request token gets expired within the next 5 minutes. My application requires me to execute the Python script for a long period of time without manual login from the user. Is there a solution to work my way around this issue where the token gets expired?

NOTE:- I need the script to be continuously executed for a certain period of time without Manual Login from the user.
  • trade_then
    manual login is required only once in a day. Request token needs to be converted to Access token and, used for rest of the operations. userinfo = kite.GenerateSession( request_token, api_secret ) ; is how it is done in C# something similar must be there in python too. userinfo fields will have all the information you will need for rest of the day.

    Thanks
    Regards
  • sujith
    @nirmalthomas26,
    Once you get access token, store it in preference or database and use it in subsequent runs. Make sure you don't call generateSession every time you run your script.
Sign In or Register to comment.