push采用try避免失败导致程序崩溃

This commit is contained in:
CSSC-WORK\murmur 2024-01-05 16:04:19 +08:00
parent 5c72d169d5
commit 1e2b50cbdb

View File

@ -68,28 +68,34 @@ def s2wx(title="",description="", content=""):
logger.debug("msgpusher {}",res) logger.debug("msgpusher {}",res)
except: except:
logger.error("msgpusher error"); logger.error("msgpusher error");
res = requests.post("http://106.52.193.182:10004/message?token=AK9uikNvF7HxlGG", json={ try:
"title": title, res = requests.post("http://106.52.193.182:10004/message?token=AK9uikNvF7HxlGG", json={
"description": description, "title": title,
"message": c, "description": description,
"extras": { "message": c,
"client::display": { "extras": {
"contentType": "text/markdown" "client::display": {
}} "contentType": "text/markdown"
}) }}
logger.debug("Gotify {}",res) })
return logger.debug("Gotify {}",res)
# res = requests.post("http://106.52.193.182:10004/message?token=AK9uikNvF7HxlGG", json={ except:
res = requests.post("http://127.0.0.1:10004/message?token=AQNbWzNcL.DB.hP", json={ logger.error("Gotify error");
"title": title, try:
"description": description, # res = requests.post("http://106.52.193.182:10004/message?token=AK9uikNvF7HxlGG", json={
"message": c, res = requests.post("http://127.0.0.1:10004/message?token=AQNbWzNcL.DB.hP", json={
"extras": { "title": title,
"client::display": { "description": description,
"contentType": "text/markdown" "message": c,
}} "extras": {
}) "client::display": {
logger.debug("Gotify {}",res) "contentType": "text/markdown"
}}
})
logger.debug("Gotify {}",res)
except:
logger.error("Gotify (127.0.0.1) error");
# try: # try:
# try: # try:
# res = res.json() # res = res.json()