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

Function gotify

notify.py:248–268  ·  view source on GitHub ↗

使用 gotify 推送消息。

(title: str, content: str)

Source from the content-addressed store, hash-verified

246
247
248def gotify(title: str, content: str) -> None:
249 """
250 使用 gotify 推送消息。
251 """
252 if not push_config.get("GOTIFY_URL") or not push_config.get("GOTIFY_TOKEN"):
253 print("gotify 服务的 GOTIFY_URL 或 GOTIFY_TOKEN 未设置!!\n取消推送")
254 return
255 print("gotify 服务启动")
256
257 url = f'{push_config.get("GOTIFY_URL")}/message?token={push_config.get("GOTIFY_TOKEN")}'
258 data = {
259 "title": title,
260 "message": content,
261 "priority": push_config.get("GOTIFY_PRIORITY"),
262 }
263 response = requests.post(url, data=data).json()
264
265 if response.get("id"):
266 print("gotify 推送成功!")
267 else:
268 print("gotify 推送失败!")
269
270
271def iGot(title: str, content: str) -> None:

Callers

nothing calls this directly

Calls 1

printFunction · 0.85

Tested by

no test coverage detected