INNER CODE UNIT · Python

autologin_with_retry

buzzsubash/algo_trading_strategies_india · broker-utilities/zerodha-kite-connect-auto-login.py:286

    def autologin_with_retry(self, max_retries=None, retry_delay=None):
        """Perform auto-login with retry mechanism"""
        max_retries = max_retries or self.config.MAX_RETRIES
        retry_delay = retry_delay or self.config.RETRY_DELAY

        for attempt in range(max_retries):
            try:
                logging.info(f"Login attempt {attempt + 1}/{max_retries}")
                return self.perform_login()

            except Exception as e:
                logging.error(f"Login attempt {attempt + 1} failed: {e}")

                if attempt < max_retries - 1:
                    logging.info(f"Retrying in {retry_delay} seconds...")
                    time.sleep(retry_delay)
                else:
                    logging.error("All login attempts failed")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…