It looks like you're new here. If you want to get involved, click one of these buttons!
kite = KiteConnect(api_key=zerodha_api_key)
driver = webdriver.Chrome(Webdriver_chrome)
url = kite.login_url()
driver.get(url)
print("login Url: ", url)
# Login Into Zerodha Account
user_id = WebDriverWait(driver, 5).until(lambda x: x.find_element_by_xpath("//*[@id='userid']")).send_keys(zerodha_user_id)
password = WebDriverWait(driver, 5).until(lambda x: x.find_element_by_xpath("//*[@id='password']")).send_keys(zerodha_password)
submit = WebDriverWait(driver, 5).until(lambda x: x.find_element_by_xpath("//*[@id='container']/div/div/div/form/div[4]/button")).submit()
auth_key = pyotp.TOTP(zerodha_totp_key)
print(auth_key.now())
totp = WebDriverWait(driver, 5).until(lambda x: x.find_element_by_xpath("//*[@id='totp']")).send_keys(auth_key.now())
submit_btn = WebDriverWait(driver, 5).until(lambda x: x.find_element_by_xpath("//*[@id='container']/div/div/div/form/div[3]/button")).submit()
# Request Token
sleep(2)
Current_url = driver.current_url
driver.close()
print(Current_url)
initial_token = Current_url.split('request_token=')[1]
request_token = initial_token.split('&')[0]
print("request_token: ", request_token)
# Access Token
data = kite.generate_session(request_token, api_secret=zerodha_api_secrets)
kite.set_access_token(data["access_token"])
acc_tkn = data['access_token']
In this Code I'm using selenium method for login, and then fetching request token and then access token.HTTPSConnectionPool(host='api.kite.trade', port=443): Max retries exceeded with url: /quote/ltp?i=NFO%3ABANKNIFTY22JANFUT (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x0000029535458B20>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))