import datetime
import requests
import json
# 禅道接口地址
url = "http://your.zentao.url/api-bug-list"
# 禅道接口参数,按需修改
data = {
"status": "active",
"type": "bug",
"orderBy": "id_desc",
"limit": 100,
"offset": 0,
"recTotal": "yes",
"assignedTo": "me"
}
# 钉钉机器人webhook地址,按需修改
dingding_url = "https://oapi.dingtalk.com/robot/send?access_token=your_access_token"
# 获取当前时间
now = datetime.datetime.now()
# 判断是否为每天下午5点
if now.hour == 17:
# 发送请求,获取禅道bug列表
response = requests.post(url, data=data)
bug_list = json.loads(response.text)["data"]
# 构造钉钉消息
message = {
"msgtype": "text",
"text": {
"content": "禅道未处理的bug:\n"
}
}
for bug in bug_list:
message["text"]["content"] += f"{bug['id']} {bug['title']}\n"
# 发送钉钉消息
requests.post(dingding_url, json=message)
禅道bug定时自动通知钉钉群,实现bug状态自由通知
最新推荐文章于 2024-08-15 17:06:50 发布