INNER CODE UNIT · Python

__init__

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

    def __init__(self, token):
        self.token = token
        self.base_url = f"https://api.telegram.org/bot{token}/sendMessage"

    def send_message(self, text, chat_id):
        """Send message to Telegram chat"""
        try:
            payload = {
                'chat_id': chat_id,
                'text': text,
                'parse_mode': 'HTML'
            }
            response = requests.post(self.base_url, json=payload, timeout=10)
            return response.json()
        except Exception as e:
            logging.error(f"Failed to send Telegram message: {e}")
            return None

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…