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

Method send_mpnews

sendNotify.py:311–333  ·  view source on GitHub ↗
(self, title, message, media_id, touser="@all")

Source from the content-addressed store, hash-verified

309 return respone["errmsg"]
310
311 def send_mpnews(self, title, message, media_id, touser="@all"):
312 send_url = 'https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=' + self.get_access_token()
313 send_values = {
314 "touser": touser,
315 "msgtype": "mpnews",
316 "agentid": self.AGENTID,
317 "mpnews": {
318 "articles": [
319 {
320 "title": title,
321 "thumb_media_id": media_id,
322 "author": "Author",
323 "content_source_url": "",
324 "content": message.replace('\n', '<br/>'),
325 "digest": message
326 }
327 ]
328 }
329 }
330 send_msges = (bytes(json.dumps(send_values), 'utf-8'))
331 respone = requests.post(send_url, send_msges)
332 respone = respone.json()
333 return respone["errmsg"]
334
335def send(title, content):
336 """

Callers 1

wecom_appFunction · 0.95

Calls 1

get_access_tokenMethod · 0.95

Tested by

no test coverage detected