data = kite.generate_session(request_token, api_secret=secret_key) kite.set_access_token(data["access_token"]) access_token=data['access_token']
logging.basicConfig(level=logging.DEBUG)
def on_ticks(ws, ticks): # Callback to receive ticks. logging.debug("Ticks: {}".format(ticks))
def on_connect(ws, response): # Callback on successful connect. # Subscribe to a list of instrument_tokens (RELIANCE and ACC here). ws.subscribe([408065])
# Set RELIANCE to tick in `full` mode. ws.set_mode(ws.MODE_FULL, [408065])
def on_close(ws, code, reason): # On connection close stop the main loop # Reconnection will not happen after executing `ws.stop()` ws.stop()
Before all that please ensure that you access_token is passed to your code. Historically on this forum, this error in most of the cases has been related developers not passing their access token correctly or were not even aware that there was no token passed
# I set the access token first this way after getting the request token.
data = kite.generate_session(request_token, api_secret=secret_key)
kite.set_access_token(data["access_token"])
access_token=data['access_token']
# Then i passed it to the object as given on github.
kws = KiteTicker(api_key, access_token)
But for some reason its giving this error. Dont know what i am missing here.