钉钉群机器人发送消息python脚本,可用作监控告警使用
如何使用:
1、注册个钉钉账号
2、创建一个群
3、添加群机器人
4、复制webhook到脚本api_url中python脚本
#!/usr/bin/python
# -*- coding: utf-8 -*-
 
import requests
import json
import sys
import os
 
headers = {'Content-Type': 'application/json;charset=utf-8'}
api_url = "https://oapi.dingtalk.com/robot/send?access_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
 
def msg(text):
    json_text= {
     "msgtype": "text",
        #@群成员参数,填写手机号
        "at": {
            "atMobiles": [
                "xxxxxxxxxxx"
        ],
            "isAtAll": False
        },
    "text": {
            "content": text
    }    
    }
    print requests.post(api_url,json.dumps(json_text),headers=headers).content
     
if __name__ == '__main__':
    text = sys.argv[3]
    msg(text)  本文最后记录时间 2024-03-31
文章链接地址:https://wojc.cn/archives/451.html
本站文章除注明[转载|引用|来源|来自],均为本站原创内容,转载前请注明出处
  文章链接地址:https://wojc.cn/archives/451.html
本站文章除注明[转载|引用|来源|来自],均为本站原创内容,转载前请注明出处
 

 
 
钉钉办公利器
:mrgreen:博客 的footer.php页面的站点地图代码,可否提供一下呢?
你用这个网站https://www.xml-sitemaps.com生成下就行了,我就用的它