V1
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import requests
|
||||
|
||||
def push_gotify(title, message, priority=0):
|
||||
# ========== 在这里改成你自己的信息 ==========
|
||||
GOTIFY_URL = "http://1.14.127.179:40266" # 你的 Gotify 地址
|
||||
APP_TOKEN = "AxoAjSFEhoFY_ln" # 你的 APP Token
|
||||
|
||||
url = f"{GOTIFY_URL}/message"
|
||||
|
||||
params = {
|
||||
"token": APP_TOKEN,
|
||||
"title": title,
|
||||
"message": message,
|
||||
"priority": priority
|
||||
}
|
||||
|
||||
try:
|
||||
resp = requests.post(url, params=params, timeout=10)
|
||||
if resp.status_code in (200, 201):
|
||||
print("推送成功")
|
||||
else:
|
||||
print(f"推送失败 {resp.status_code}: {resp.text}")
|
||||
except Exception as e:
|
||||
print(f"请求异常: {e}")
|
||||
|
||||
# 测试发送
|
||||
if __name__ == "__main__":
|
||||
push_gotify(
|
||||
title="akshare 数据处理完成",
|
||||
message="近10天数据已成功获取并处理,表格已生成",
|
||||
priority=0
|
||||
)
|
||||
Reference in New Issue
Block a user