首页 > 编程语言 > 详细

python实现钉钉报警

时间:2020-05-19 09:42:58      阅读:88      评论:0      收藏:0      [点我收藏+]
import requests import json def dingmessage(): webhook = "https://oapi.dingtalk.com/robot/send?access_token=efe407f2a73..." header = { "Content-Type": "application/json", "Charset": "UTF-8" } # text文本格式 # message = { # "msgtype": "text", # "at": { # "atMobiles": ["187xxx"], # "isAtAll": False # }, # "text": { # "content": "test" #发送的内容 # } # } # markdown文本格式 message = { "msgtype": "markdown", "markdown": { "title": "短信请求", "text": "test @187xxxx" }, "at": { # @指定报警人 "atMobiles": ["187xxxx"], "isAtAll": False } } message_json = json.dumps(message) print(message_json) info = requests.post(url=webhook,data=message_json,headers=header) print(info.text) if __name__=="__main__": dingmessage()

python实现钉钉报警

原文:https://blog.51cto.com/14163901/2496273

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!