Commit 836e63b5 by taoke

配置钉钉消息发送

parent 0ca3c2fc
......@@ -97,7 +97,7 @@ def send_dingding(product_name):
if product_name == BmyConfig.name:
dingTalk_markdown_bmy(BaseConfig.bmy_group) # 给交委项目相关群发送钉钉
if product_name == SSOConfig.name:
pass
dingTalk_markdown_sso(BaseConfig.sso_group)
# 交委
if product_name == SafeTransportationConfig.name:
dingTalk_markdown_safe_transportation(BaseConfig.bmy_group)
......
......@@ -86,7 +86,7 @@ def dingTalk_markdown_bmy(group):
"markdown": {
"title":"接口执行报告",
"text": f"#### 接口自动化测试报告 \n> 本消息由Jenkins构建后自动发送\n> \
![screenshot](https://aqjg.gyszhjt.com:60028/img/group1/M00/00/04/Cgs5XWD2NrOACeeHAAhEU1jS9Xc475.png)\n> ###### 点击查看 >> [安全运输](http://10.197.236.10:8080/job/bmy/allure/) \n"
\n> ###### 点击查看 >> [企业云测试报告](http://10.197.236.10:8080/job/bmy/allure/) \n"
},
'at': {'isAtAll': False}}
post_data = json.dumps(data)
......@@ -103,14 +103,34 @@ def dingTalk_markdown_safe_transportation(group):
"markdown": {
"title":"接口执行报告",
"text": f"#### 接口自动化测试报告 \n> 本消息由Jenkins构建后自动发送\n> \
![screenshot](https://img.banmago.com/group2/M00/06/BB/rBrpX2El37CASho8ABlIIu9o6i4942.png)\n> ###### 点击查看 >> [交委安全运输监管平台](http://10.197.236.10:8080/job/safe_transportation/allure/) \n"
\n> ###### 点击查看 >> [交委安全运输监管平台](http://10.197.236.10:8080/job/safe_transportation/allure/) \n"
},
'at': {'isAtAll': False}}
post_data = json.dumps(data)
requests.post(webhook, headers=BaseConfig.headers, data=post_data)
def dingTalk_markdown_sso(group):
for i in group:
"""发送消息到钉钉群(sso)"""
timestamp = str(round(time.time() * 1000))
sign=get_sign(i["secret"])
webhook=i["webhook"]+f"&timestamp={timestamp}&sign={sign}"
now_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M')
data = {'msgtype': 'markdown',
"markdown": {
"title":"接口执行报告",
"text": f"#### 接口自动化测试报告 \n> 本消息由Jenkins构建后自动发送\n> \
\n> ###### 点击查看 >> [统一登录平台](http://10.197.236.10:8080/job/sso/allure/) \n"
},
'at': {'isAtAll': False}}
post_data = json.dumps(data)
requests.post(webhook, headers=BaseConfig.headers, data=post_data)
# """ 通用 (未调试)"""
# (https://img.banmago.com/group2/M00/06/BB/rBrpX2El37CASho8ABlIIu9o6i4942.png)
# def dingTalk_markdown(group,picture,title,allureurl):
# for i in group:
# timestamp = str(round(time.time() * 1000))
......@@ -149,6 +169,6 @@ if __name__ == '__main__':
{"secret": "SEC465015385218e70a94f107a16f72dd33d8fc118c3b2a631e0433685302f2fbb3",
"webhook": "https://oapi.dingtalk.com/robot/send?access_token=229908a83825ed56abbf728d3382e446a4e8a90e9ad302c37a036bcbccbbf9ee",
"group": "自动化小组"}]
dingTalk_markdown_safe_transportation(bmy_group)
dingTalk_markdown_bmy(test_group)
# dingTalk_markdown(test_group,"https://aqjg.gyszhjt.com:60028/img/group1/M00/00/04/Cgs5XWD2NrOACeeHAAhEU1jS9Xc475.png","交委项目","http://10.197.236.10:8080/job/bmc/allure/")
\ No newline at end of file
......@@ -32,6 +32,11 @@ class BaseConfig():
"group": "测试序列"}
]
# 统一登录平台钉钉发送群
sso_group=[{"secret": "SEC7714672a0be0239dbff12083d6beca3961490f1f5384c616ea259015d7e71cd1",
"webhook": "https://oapi.dingtalk.com/robot/send?access_token=10baf66992f12849793666ee882569bf50d313e9c070ab1afbff25cb9ffcd567",
"group": "测试序列"}]
# 日志相关
log_path = r'' # 日志路径
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment