From 1e2b50cbdba3599ce699d925beac8a4aece61970 Mon Sep 17 00:00:00 2001 From: "CSSC-WORK\\murmur" Date: Fri, 5 Jan 2024 16:04:19 +0800 Subject: [PATCH] =?UTF-8?q?push=E9=87=87=E7=94=A8try=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E5=AF=BC=E8=87=B4=E7=A8=8B=E5=BA=8F=E5=B4=A9?= =?UTF-8?q?=E6=BA=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.py | 50 ++++++++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/server.py b/server.py index bde1b7e..b1b0ec9 100755 --- a/server.py +++ b/server.py @@ -68,28 +68,34 @@ def s2wx(title="",description="", content=""): logger.debug("msgpusher {}",res) except: logger.error("msgpusher error"); - res = requests.post("http://106.52.193.182:10004/message?token=AK9uikNvF7HxlGG", json={ - "title": title, - "description": description, - "message": c, - "extras": { - "client::display": { - "contentType": "text/markdown" - }} - }) - logger.debug("Gotify {}",res) - return - # res = requests.post("http://106.52.193.182:10004/message?token=AK9uikNvF7HxlGG", json={ - res = requests.post("http://127.0.0.1:10004/message?token=AQNbWzNcL.DB.hP", json={ - "title": title, - "description": description, - "message": c, - "extras": { - "client::display": { - "contentType": "text/markdown" - }} - }) - logger.debug("Gotify {}",res) + try: + res = requests.post("http://106.52.193.182:10004/message?token=AK9uikNvF7HxlGG", json={ + "title": title, + "description": description, + "message": c, + "extras": { + "client::display": { + "contentType": "text/markdown" + }} + }) + logger.debug("Gotify {}",res) + except: + logger.error("Gotify error"); + try: + # res = requests.post("http://106.52.193.182:10004/message?token=AK9uikNvF7HxlGG", json={ + res = requests.post("http://127.0.0.1:10004/message?token=AQNbWzNcL.DB.hP", json={ + "title": title, + "description": description, + "message": c, + "extras": { + "client::display": { + "contentType": "text/markdown" + }} + }) + logger.debug("Gotify {}",res) + except: + logger.error("Gotify (127.0.0.1) error"); + # try: # try: # res = res.json()