首页 > 技术 > 机器人

python 钉钉机器人接收消息 | 机器人脚本

人阅读 2023-10-24 20:07:58

【python 钉钉机器人接收消息 | 机器人脚本】lot物联网小编为你整理了的相关内容,希望能为你解答。

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)至此可以进行测试发布信息了,点赞!

以上内容为【python 钉钉机器人接收消息 | 机器人脚本】的相关内容,更多相关内容关注lot物联网。

LOT物联网

iot产品 iot技术 iot应用 iot工程

Powered By LOT物联网  闽ICP备2024036174号-1

联系邮箱:support1012@126.com