监控☞企业微信机器人

阅读量: zyh 2020-05-14 09:34:44
Categories: Tags:

shell

wechatUrl=
wechatData=
curl ${wechatUrl} -H 'Content-Type: application/json' -d '{"msgtype": "markdown","markdown": {"content": "`'"$wechatData"'`"}}'

python

import json, requests
wechatData={"msgtype": "text","text": {"content": ""}}
wechatData['text']['content']='广州今日天气:29度,大部分多云,降雨概率:60%'
wechatData['text']['mentioned_list']=["zyh"]  # all 代表群组所有人
wechatData=json.dumps(wechatData)
wechatUrl=
requests.post(url=wechatUrl, headers={"Content-Type": "application/json"}, data=wechat
Data, timeout=5)