使用 gotify 推送消息。
(title: str, content: str)
| 274 | |
| 275 | |
| 276 | def 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 | |
| 298 | def iGot(title: str, content: str) -> None: |