import requests class FeishuBot: webhook_url = "https://open.feishu.cn/open-apis/bot/v2/hook/your_webhook_id" def __init__(self): self.webhook_url = self.webhook_url def send_message(self, message_text): headers = {'Content-Type': 'application/json'} data = { "msg_type": "text", "content": {"text": message_text} } response = requests.post(self.webhook_url, json=data, headers=headers) response.raise_for_status() # 如果响应状态码不是200,则抛出HTTPError异常 return response.json() # 返回JSON响应(如果需要的话)