feishutongzhi.py
#!/usr/bin/env python
#-*- encoding:utf-8 -*-
import sys
import requests
JOB_URL = sys.argv[1]
JOB_NAME = sys.argv[2]
url = '飞书webhook地址'
method = 'post'
headers = {
'Content-Type': 'application/json'
}
json = {
"msg_type": "interactive",
"card": {
"config": {
"wide_screen_mode": True,
"enable_forward": True
},
"elements": [{
"tag": "div",
"text": {
"content": JOB_NAME + " 构建完成",
"tag": "lark_md"
}
}, {
"actions": [{
"tag": "button",
"text": {
"content": "构建报告",
"tag": "lark_md"
},
"url": JOB_URL,
"type": "default",
"value": {}
}],
"tag": "action"
}],
"header": {
"title": {
"content": "大家好",
"tag": "plain_text"
}
}
}
}
requests.request(method=method, url=url, headers=headers, json=json)