起因:每次发布版本都要再打开微信去艾特对应的负责人,这一步挺机械的,看到运维群有机器人自动发消息,查了下有开放API可自定义消息。
https://work.weixin.qq.com/api/doc/90000/90135/90239
'''
Date: 2021-01-31 18:57:35
LastEditors: yanghh
LastEditTime: 2021-01-31 18:57:59
FilePath: /roh5/Users/yanghh/Desktop/notify.py
'''
from urllib import request
import os
import json
import sys
Version = sys.argv[1]
def http_post(url,data_json):
jdata = json.dumps(data_json).encode()
# print('jdata ',jdata)
req = request.Request(url, jdata)
response = request.urlopen(req)
return response.read()
url = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxxxx'
data_json = {'msgtype': 'text','text':{
"content": "BiliBili传包完成,请通知KK设置审核服版本号{0},二维码地址:https://miniapp.bilibili.com/smallapp/#/app/devmng/biligamexxxxxxx".format(Version),
"mentioned_mobile_list":["12345657","424575658"]
}}
resp = http_post(url,data_json)
print("resp ",resp)