python操作钉钉机器人推送消息
·
群里面设置





使用关键词,必须要携带这个关键词才能调用这个机器人

下一步,这个就是操作这个钉钉机器人的接口

allure测试报告 关键词一定要写在 content字段里面
import json
import requests
def dd_robot():
HEADERS = {"Content-Type": "application/json;charset=utf-8"}
# 之前复制的接口地址和token信息
url = 'https://oapi.dingtalk.com/robot/send?xxx'
#content里面要设置关键字
data_info = {
"msgtype": "text",
"text": {
"content": 'allure测试报告:lll'
},
"isAtAll": False
#这是配置需要@的人
# ,"at": {"atMobiles": ["15xxxxxx06",'18xxxxxx1']}
}
value = json.dumps(data_info)
response = requests.post(url,data=value,headers=HEADERS)
if response.json()['errmsg']!='ok':
print(response.text)
if __name__ == '__main__':
dd_robot()
测试

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。
更多推荐



所有评论(0)