12345678910111213141516171819202122 |
- import requests
- class FeishuBot:
- webhook_url = "https://open.feishu.cn/open-apis/bot/v2/hook/cbf0bc0f-994a-489b-9f77-de0c5be107cd"
- 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响应(如果需要的话)
- # if __name__ == '__main__':
- # bot = FeishuBot()
- # msg = (f'推荐模型数据更新 \n step1【校验hive数据源】【success】:\n'
- # f'读取project.table,分区:dt= partitionDt/hh=partitionHh,数据总量:count')
- # msg = ('1')
- # print(bot.send_message(msg))
|