From 239ab821c3ba6dfb283105e131f3a0128868f3f8 Mon Sep 17 00:00:00 2001 From: Akimio521 Date: Sun, 25 Feb 2024 14:58:20 +0800 Subject: [PATCH] =?UTF-8?q?iGot=E8=87=AA=E5=AE=9A=E4=B9=89=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sample/notify.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sample/notify.py b/sample/notify.py index 197992c8..056b0f06 100644 --- a/sample/notify.py +++ b/sample/notify.py @@ -284,16 +284,16 @@ def gotify(title: str, content: str, **kwargs) -> None: print("gotify 推送失败!") -def iGot(title: str, content: str) -> None: +def iGot(title: str, content: str, **kwargs) -> None: """ 使用 iGot 推送消息。 """ - if not push_config.get("IGOT_PUSH_KEY"): + if not (kwargs.get("IGOT_PUSH_KEY") or push_config.get("IGOT_PUSH_KEY")): print("iGot 服务的 IGOT_PUSH_KEY 未设置!!\n取消推送") return print("iGot 服务启动") - - url = f'https://push.hellyw.com/{push_config.get("IGOT_PUSH_KEY")}' + IGOT_PUSH_KEY = kwargs.get("IGOT_PUSH_KEY", push_config.get("IGOT_PUSH_KEY")) + url = f'https://push.hellyw.com/{IGOT_PUSH_KEY}' data = {"title": title, "content": content} headers = {"Content-Type": "application/x-www-form-urlencoded"} response = requests.post(url, data=data, headers=headers).json()