1.机器人创建以及获取秘钥信息
1.创建dingding群
2.创建智能群助手
3.查看群助手的webhook

4.拷贝信息后面使用
5.编写基于python脚本的发送dingding信息
class SendDing:
def __init__(self, info):
self.info = info
def sendinfo(self):
# 请求的URL,WebHook地址
webhook = "钉钉webhook地址"
# 构建请求头部
header = {
"Content-Type": "application/json",
"Charset": "UTF-8"
}
# 构建请求数据
tex = self.info
message = {
"msgtype": "text",
"text": {
"content": tex
},
"at": {
"isAtAll": True
}
}
# 对请求的数据进行json封装
message_json = json.dumps(message)
# 发送请求
info = requests.post(url=webhook, data=message_json, headers=header)
# 打印返回的结果
print(info.text)
至此可以进行测试发布信息了,点赞!