MCPcopy
hub / github.com/smallfawn/QLScriptPublic / gotify

Function gotify

notify.py:276–295  ·  view source on GitHub ↗

使用 gotify 推送消息。

(title: str, content: str)

Source from the content-addressed store, hash-verified

274
275
276def gotify(title: str, content: str) -> None:
277 """
278 使用 gotify 推送消息。
279 """
280 if not push_config.get("GOTIFY_URL") or not push_config.get("GOTIFY_TOKEN"):
281 return
282 print("gotify 服务启动")
283
284 url = f'{push_config.get("GOTIFY_URL")}/message?token={push_config.get("GOTIFY_TOKEN")}'
285 data = {
286 "title": title,
287 "message": content,
288 "priority": push_config.get("GOTIFY_PRIORITY"),
289 }
290 response = requests.post(url, data=data).json()
291
292 if response.get("id"):
293 print("gotify 推送成功!")
294 else:
295 print("gotify 推送失败!")
296
297
298def iGot(title: str, content: str) -> None:

Callers

nothing calls this directly

Calls 3

printFunction · 0.70
getMethod · 0.45
postMethod · 0.45

Tested by

no test coverage detected