It looks like you're new here. If you want to get involved, click one of these buttons!
request_access_token
from kiteconnect import KiteConnectfrom kiteconnect import KiteTickerimport datetimeimport ostoken_file = str(datetime.datetime.now().date()) + ' token' + '.txt'if token_file not in os.listdir(): kite = KiteConnect(api_key=api_k) data = kite.generate_session(request_tkn, api_secret=api_s) access_token = data["access_token"] kite.set_access_token(access_token) file = open(token_file, 'w') file.write(access_token) file.close() # storing token in today's fileelif token_file in os.listdir(): # reading and reusing token from today's file kite = KiteConnect(api_key=api_k) file = open(token_file, 'r+') access_token = file.read() file.close() kite.set_access_token(access_token)
You just need to store access_token and public_token in text file or database and re-use it.
You just need to make sure
request_access_token
is not called in subsequent run.kite = KiteConnect("xxxx","xxxxxx")
kite = KiteConnect(api_key,access_token)
i don't know why this syntax is not mentioned in any of your doc.
An access_token is an optional parameter which is mentioned in the documentation.
thanks in advance
you can refer to the below code snippet.