Merge pull request #37 from lyz05/0807pushplus
Some checks failed
SyncMirror / sync (push) Has been cancelled
Some checks failed
SyncMirror / sync (push) Has been cancelled
feat: PushPlus 推送支持
This commit is contained in:
commit
056c5528e5
|
|
@ -15,6 +15,9 @@ notifications:
|
||||||
telegram:
|
telegram:
|
||||||
bot_token: "6689586847:AAH0lg1uuXiZMsou9WNYif7qqrbCSdZWWj0"
|
bot_token: "6689586847:AAH0lg1uuXiZMsou9WNYif7qqrbCSdZWWj0"
|
||||||
chat_id: "1762053255"
|
chat_id: "1762053255"
|
||||||
|
# PushPlus推送加,https://www.pushplus.plus/
|
||||||
|
pushplus:
|
||||||
|
key: ""
|
||||||
|
|
||||||
######## 以下为账号配置项,可以多账号,详情请参考文档 ########
|
######## 以下为账号配置项,可以多账号,详情请参考文档 ########
|
||||||
accounts:
|
accounts:
|
||||||
|
|
|
||||||
25
main.py
25
main.py
|
|
@ -153,6 +153,31 @@ def send_notifications(message: str, settings: dict, proxy: str = None):
|
||||||
else:
|
else:
|
||||||
logger.debug("DingTalk not configured.")
|
logger.debug("DingTalk not configured.")
|
||||||
|
|
||||||
|
# PushPlus
|
||||||
|
sct_conf = settings.get("pushplus", {})
|
||||||
|
sct_key = sct_conf.get("key")
|
||||||
|
if sct_key:
|
||||||
|
sct_url = f"http://www.pushplus.plus/send/{sct_key}"
|
||||||
|
try:
|
||||||
|
payload = {"title": "MHYY-AutoCheckin 状态推送", "content": message}
|
||||||
|
response = httpx.post(sct_url, data=payload, timeout=10)
|
||||||
|
response.raise_for_status()
|
||||||
|
logger.info("PushPlus notification sent successfully.")
|
||||||
|
except httpx.HTTPStatusError as e:
|
||||||
|
logger.error(
|
||||||
|
f"PushPlus HTTP error occurred: {e.response.status_code} - {e.response.text}"
|
||||||
|
)
|
||||||
|
except httpx.RequestError as e:
|
||||||
|
logger.error(f"An error occurred while requesting PushPlus: {e}")
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(
|
||||||
|
f"An unexpected error occurred sending PushPlus notification: {e}"
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
logger.debug("PushPlus not configured.")
|
||||||
|
|
||||||
|
|
||||||
|
# Telegram
|
||||||
telegram_conf = settings.get("telegram", {})
|
telegram_conf = settings.get("telegram", {})
|
||||||
telegram_bot_token = telegram_conf.get("bot_token")
|
telegram_bot_token = telegram_conf.get("bot_token")
|
||||||
telegram_chat_id = telegram_conf.get("chat_id")
|
telegram_chat_id = telegram_conf.get("chat_id")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user