26 lines
962 B
Python
26 lines
962 B
Python
|
|
import requests
|
|
import json
|
|
from logger import logger
|
|
|
|
#feishu_webhook_url = "https://open.feishu.cn/open-apis/bot/v2/hook/0a627129-bfe9-4958-a1c8-9dd38ece6016"
|
|
feishu_webhook_url = "https://open.feishu.cn/open-apis/bot/v2/hook/051679ae-0bef-4a21-9ff7-25fd76cd73ee"
|
|
def send_feishu_notification_text(message):
|
|
headers = {
|
|
'Content-Type': 'application/json;charset=utf-8'
|
|
}
|
|
payload = {
|
|
"msg_type": "text",
|
|
"content": {
|
|
"text": message
|
|
}
|
|
}
|
|
|
|
try:
|
|
response = requests.post(feishu_webhook_url, headers=headers, data=json.dumps(payload))
|
|
if response.status_code == 200:
|
|
logger.info(f"飞书通知发送成功: {message}")
|
|
else:
|
|
logger.error(f"飞书通知发送失败,状态码: {response.status_code},消息: {message}")
|
|
except requests.exceptions.RequestException as e:
|
|
logger.error(f"飞书通知发送失败: {e},消息: {message}")
|