# coding:utf-8 import requests from loguru import logger def send_weixin(content,url): try: if not url: return headers = {"Content-Type": "application/json"} # http数据头,类型为json data = { "msgtype": "text", "text": { "content": content, # 让群机器人发送的消息内容。 "mentioned_list": [], } } proxy = { "http": "http://172.17.221.150:10991", "https": "http://172.17.221.150:10991", } r = requests.post(url, headers=headers, json=data, proxies=proxy) # 利用requests库发送post请求 if r.status_code == 200: logger.warning("告警发送成功") return logger.warning("告警发送失败") except Exception as e: logger.warning({f"告警程序错误::{e}"})