-
Automating Zerodha Login with Python, Selenium, and TOTP.
This Python script automates the login process to Zerodha’s Kite Connect API using Selenium and TOTP-based two-factor authentication. It begins by setting the working directory and reading API credentials from a file, then initializes the Kite Connect session and opens the Zerodha login page in a Chrome browser. Using Selenium, it inputs the user ID and password, generates a time-based OTP using a secret key, and submits the login form. After successfully logging in and being redirected, the script extracts the request token from the URL, uses it along with the API secret to generate an access token, and saves this token to a file for future API interactions. Explanation…