Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Key Error Message in Python
Message
From
02/03/2023 14:01:16
 
 
To
All
General information
Forum:
Python
Category:
Troubleshooting
Title:
Key Error Message in Python
Miscellaneous
Thread ID:
01686300
Message ID:
01686300
Views:
49
Respected Experts
I am trying this code to establish connection with Zerodha using zerodha Kite connect API.
Here is my code


import logging
from kiteconnect import KiteConnect
logging.basicConfig(level=logging.DEBUG)
key="4i567ljv5YNgrfdy"
kite = KiteConnect(api_key=key)
print(kite.login_url())

secret="eqzjjerdfxrkn5o6rtf4fi5pdxjyhb"

# Redirect the user to the login url obtained
# from kite.login_url(), and receive the request_token
# from the registered redirect url after the login flow.
# Once you have the request_token, obtain the access_token
# as follows.
data = kite.generate_session("siyi2w6eIbZ5tSDfZ0ATPR1RiSGWrboX",secret)
print(data)
# From Print(data) I get Acccess token and Place it in the line below and execute.
kite.set_access_token(data["85u1996Pgpy3+qNayVLeObo5ssdz"])



The Last line gives me an error as
Key Error : '85u1996Pgpy3+qNayVLeObo5ssdz'

This is exactly as per the kit connect documentation as available,
https://github.com/zerodha/pykiteconnect

Where I am doing wrong ?

Thanks
Harsh
Next
Reply
Map
View

Click here to load this message in the networking platform