MCPcopy Create free account
hub / github.com/MoMingRose/QLAutomateTasks / pushplus_bot

Function pushplus_bot

notify.py:357–389  ·  view source on GitHub ↗

通过 push+ 推送消息。

(title: str, content: str)

Source from the content-addressed store, hash-verified

355
356
357def pushplus_bot(title: str, content: str) -> None:
358 """
359 通过 push+ 推送消息。
360 """
361 if not push_config.get("PUSH_PLUS_TOKEN"):
362 print("PUSHPLUS 服务的 PUSH_PLUS_TOKEN 未设置!!\n取消推送")
363 return
364 print("PUSHPLUS 服务启动")
365
366 url = "http://www.pushplus.plus/send"
367 data = {
368 "token": push_config.get("PUSH_PLUS_TOKEN"),
369 "title": title,
370 "content": content,
371 "topic": push_config.get("PUSH_PLUS_USER"),
372 }
373 body = json.dumps(data).encode(encoding="utf-8")
374 headers = {"Content-Type": "application/json"}
375 response = requests.post(url=url, data=body, headers=headers).json()
376
377 if response["code"] == 200:
378 print("PUSHPLUS 推送成功!")
379
380 else:
381 url_old = "http://pushplus.hxtrip.com/send"
382 headers["Accept"] = "application/json"
383 response = requests.post(url=url_old, data=body, headers=headers).json()
384
385 if response["code"] == 200:
386 print("PUSHPLUS(hxtrip) 推送成功!")
387
388 else:
389 print("PUSHPLUS 推送失败!")
390
391
392def qmsg_bot(title: str, content: str) -> None:

Callers

nothing calls this directly

Calls 1

printFunction · 0.85

Tested by

no test coverage detected