Error while generating request token token using python

ZerodhaAlgoTrading
Dear Zerodha

I am aware that exchange mandated that we have to login manually at least once even if we use Algo. I use to login at least 5 times to track my positions once Algo place the orders. (I hope I am following exchange guidelines)

But, I am unable manage every day to create a access token manually and pass it to Algo before market open so I want my code to do that :)

Coming to the error.
I am using automated way to generate access token for whole day. But, after TOTP enters , out of 5 days at least 1 day I am redirecting to logout URL instead of request token URL

Error : URL is https://kite.zerodha.com/#loggedout

Below is the code

authkey = pyotp.TOTP(totp_key)
totp.send_keys(authkey.now())
logging.info("After TOTP Enters")
continue_btn = WebDriverWait(driver, 10).until(lambda x: x.find_element("xpath",'//*[@id="container"]/div/div/div[2]/form/div[3]/button'))
continue_btn.click()

time.sleep(5)

url = driver.current_url
logging.info("URL is %s : ", url) -------> Here it is once in a week coming as https://kite.zerodha.com/#loggedout

May I know what is the issue and why it is happening intermittently ?


Thanks.
Tagged:
Sign In or Register to comment.