INNER CODE UNIT · Python

ServerThread

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

class ServerThread(threading.Thread):
    """Thread class to run Flask server in background"""

    def __init__(self, app, host, port):
        threading.Thread.__init__(self)
        self.server = make_server(host, port, app)
        self.ctx = app.app_context()
        self.ctx.push()
        self.host = host
        self.port = port

    def run(self):
        """Start the Flask server"""
        logging.info(f'Starting server on {self.host}:{self.port}')
        self.server.serve_forever()

    def shutdown(self):
        """Shutdown the Flask server"""

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…