1、在群聊中添加一个机器人
添加完机器人之后,复制Webhook地址
具体推送消息说明,参考配置说明
#!/usr/bin/env python3 # -*-coding:utf-8 -*- import requests class SendMsg: @staticmethod def send_qy_weixin(msg):
# Webhook地址 url = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxxxxxxxxxxxxxxxxxxxxxxxxxxx' r = requests.post(url=url, json=msg, headers={'Content-type':'application/json'}) if __name__ == '__main__': send_message = { "msgtype": "markdown", "markdown": { "content": "# 网站打不开了!\n" + "> 时间:\n" + "> 域名:\n" + "> 详情:域名连续请求次,返回失败", "mentioned_list": ["@all"] } } print(SendMsg.send_qy_weixin(send_message))
标签:__,调用,weixin,微信,机器人,send,url,markdown From: https://www.cnblogs.com/ai594ai/p/16810164.html