TokenException: Invalid API credentials

sidsam12
#Please tell where I am wrong

#Got request token from login_url()

# I got access_token successfully

from kiteconnect import WebSocket
from kiteconnect import KiteConnect

instrument_token = "xxxx"

from_date = "2017-01-01"
to_date= "2017-01-31"

interval = "minute"

kite = KiteConnect(api_key = myapi_key) #success
kite.set_access_token(access_token)

# Get Historical data from Kite Connect

def get_historical_data():
return kite.historical(instrument_token, from_date, to_date, interval)

get_historical_data()

This gives me TokenException: Invalid API credentials

Please help.

This discussion has been closed.