MCPcopy Create free account
hub / github.com/Mashiro2000/HeyTapTask / wxBot

Function wxBot

sendNotify.py:218–245  ·  view source on GitHub ↗

企业微信机器人消息推送

(title, content)

Source from the content-addressed store, hash-verified

216
217# 微信机器人
218def wxBot(title, content):
219 """
220 企业微信机器人消息推送
221 """
222 if len(content.encode("unicode_escape")) >= 4096:
223 msgtype = 'text'
224 else:
225 msgtype = 'markdown'
226 print("企业微信机器人服务启动")
227 url = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send'
228 params = {
229 'key': QYWX_KEY,
230 'debug': '1'
231 }
232 headers = {
233 'Content-Type': 'application/json'
234 }
235 data = {
236 "msgtype": msgtype,
237 msgtype: {
238 "content": f'{title}\n\n{content}'
239 }
240 }
241 response = requests.post(url, headers=headers, params=params, json=data).json()
242 if response['errcode'] == 0:
243 print('推送成功!')
244 else:
245 print('推送失败!')
246
247# 企业微信 APP 推送
248def wecom_app(title, content):

Callers 1

sendFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected