|
|
@@ -1,7 +1,6 @@
|
|
|
# -*- coding: utf-8 -*-
|
|
|
import os
|
|
|
-
|
|
|
-import requests
|
|
|
+import httpx
|
|
|
|
|
|
# 青龙面板的地址
|
|
|
url = "https://qinglong.erhe.link"
|
|
|
@@ -9,7 +8,7 @@ url = "https://qinglong.erhe.link"
|
|
|
|
|
|
# 登录青龙面板
|
|
|
def login():
|
|
|
- response = requests.post(f"{url}/api/user/login", json={"username": "toor", "password": "!QAZ2wsx+0913"})
|
|
|
+ response = httpx.post(f"{url}/api/user/login", json={"username": "toor", "password": "!QAZ2wsx+0913"})
|
|
|
print(response)
|
|
|
if response.status_code != 200:
|
|
|
print(response.status_code)
|
|
|
@@ -20,7 +19,7 @@ def login():
|
|
|
|
|
|
# 获取任务列表
|
|
|
def get_tasks(token):
|
|
|
- response = requests.get(f"{url}/api/crons", headers={"Authorization": f"Bearer {token}"})
|
|
|
+ response = httpx.get(f"{url}/api/crons", headers={"Authorization": f"Bearer {token}"})
|
|
|
return response.json()['data']['data']
|
|
|
|
|
|
|
|
|
@@ -36,7 +35,7 @@ def create_task(task_template, token):
|
|
|
"Authorization": f"Bearer {token}",
|
|
|
"Content-Type": "application/json"
|
|
|
}
|
|
|
- response = requests.post(f"{url}/api/crons", headers=headers, json=payload)
|
|
|
+ response = httpx.post(f"{url}/api/crons", headers=headers, json=payload)
|
|
|
return response.json()
|
|
|
|
|
|
|
|
|
@@ -57,7 +56,7 @@ def create_view_type(token):
|
|
|
"Authorization": f"Bearer {token}",
|
|
|
"Content-Type": "application/json"
|
|
|
}
|
|
|
- response = requests.post(f"{url}/api/crons", headers=headers, json=payload)
|
|
|
+ response = httpx.post(f"{url}/api/crons", headers=headers, json=payload)
|
|
|
|
|
|
|
|
|
# 主逻辑
|
|
|
@@ -75,10 +74,11 @@ def main():
|
|
|
|
|
|
project_path = '/ql/data/scripts/AutoInfo/'
|
|
|
base_path = os.path.join(project_path, 'base')
|
|
|
- message_path = os.path.join(project_path, 'message')
|
|
|
+ to_email_tasks_path = os.path.join(project_path, 'to_email')
|
|
|
+ to_gotify_tasks_path = os.path.join(project_path, 'to_gotify')
|
|
|
manual_path = os.path.join(project_path, 'manual')
|
|
|
tasks_template = [{
|
|
|
- 'base_tasks': [
|
|
|
+ 'base': [
|
|
|
{
|
|
|
"name": "每天开始自动创建日志",
|
|
|
"command": "python3 {}/base_daily_logs_generate.py".format(base_path),
|
|
|
@@ -104,42 +104,74 @@ def main():
|
|
|
"labels": ["base"]
|
|
|
}
|
|
|
],
|
|
|
- 'message_tasks': [
|
|
|
- {
|
|
|
- "name": "获取coin实时数据",
|
|
|
- "command": "python3 {}/message_coin_detail.py".format(message_path),
|
|
|
- "schedule": "0 * * * *",
|
|
|
- "labels": ["message"]
|
|
|
- },
|
|
|
+ 'to-email': [
|
|
|
{
|
|
|
"name": "对比大乐透最新一期数据,匹配已购买号码,发送消息",
|
|
|
- "command": "python3 {}/message_dlt.py".format(message_path),
|
|
|
+ "command": "python3 {}/dlt.py".format(to_email_tasks_path),
|
|
|
"schedule": "30 22 * * 1,3,6",
|
|
|
- "labels": ["message"]
|
|
|
+ "labels": ["to-email"]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "name": "链捕手快讯消息推送",
|
|
|
+ "command": "python3 {}/chaincatcher.py".format(to_email_tasks_path),
|
|
|
+ "schedule": "0 */2 * * *",
|
|
|
+ "labels": ["to-email"]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "name": "anyknew聚合新闻消息推送",
|
|
|
+ "command": "python3 {}/anyknew.py".format(to_email_tasks_path),
|
|
|
+ "schedule": "0 */3 * * *",
|
|
|
+ "labels": ["to-email"]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "name": "反斗限免消息推送",
|
|
|
+ "command": "python3 {}/apprcn.py".format(to_email_tasks_path),
|
|
|
+ "schedule": "0 */12 * * *",
|
|
|
+ "labels": ["to-email"]
|
|
|
},
|
|
|
+ {
|
|
|
+ "name": "chiphell消息推送",
|
|
|
+ "command": "python3 {}/chiphell.py".format(to_email_tasks_path),
|
|
|
+ "schedule": "0 */12 * * *",
|
|
|
+ "labels": ["to-email"]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "name": "hello-github消息推送",
|
|
|
+ "command": "python3 {}/hello_github.py".format(to_email_tasks_path),
|
|
|
+ "schedule": "0 */12 * * *",
|
|
|
+ "labels": ["to-email"]
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ 'to-gotify': [
|
|
|
{
|
|
|
"name": "获取未来 7 天的天气预报",
|
|
|
- "command": "python3 {}/message_get_one_week_weather.py".format(message_path),
|
|
|
+ "command": "python3 {}/weather7day.py".format(to_gotify_tasks_path),
|
|
|
"schedule": "0 0 6,22 * * *",
|
|
|
- "labels": ["message"]
|
|
|
+ "labels": ["to-gotify"]
|
|
|
},
|
|
|
{
|
|
|
- "name": "从 freshrss-psql 数据库中读取数据并发送",
|
|
|
- "command": "python3 {}/message_rss_data_handel.py".format(message_path),
|
|
|
- "schedule": "30 6,9,12,18,22 * * *",
|
|
|
- "labels": ["message"]
|
|
|
+ "name": "获取coin实时数据",
|
|
|
+ "command": "python3 {}/coin_detail.py".format(to_gotify_tasks_path),
|
|
|
+ "schedule": "0 * * * *",
|
|
|
+ "labels": ["to-gotify"]
|
|
|
},
|
|
|
{
|
|
|
"name": "空投任务消息",
|
|
|
- "command": "python3 {}/message_airdrop_tasks.py".format(message_path),
|
|
|
+ "command": "python3 {}/airdrop_tasks.py".format(to_gotify_tasks_path),
|
|
|
"schedule": "0 8,20 * * *",
|
|
|
- "labels": ["message"]
|
|
|
+ "labels": ["to-gotify"]
|
|
|
},
|
|
|
{
|
|
|
- "name": "链捕手快讯消息推送",
|
|
|
- "command": "python3 {}/message_chaincatcher.py".format(message_path),
|
|
|
- "schedule": "0 */2 * * *",
|
|
|
- "labels": ["message"]
|
|
|
+ "name": "币界网消息推送",
|
|
|
+ "command": "python3 {}/coin_world.py".format(to_gotify_tasks_path),
|
|
|
+ "schedule": "0 8,20 * * *",
|
|
|
+ "labels": ["to-gotify"]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "name": " web3新闻消息推送",
|
|
|
+ "command": "python3 {}/web3_news.py".format(to_gotify_tasks_path),
|
|
|
+ "schedule": "0 9,21 * * *",
|
|
|
+ "labels": ["to-gotify"]
|
|
|
}
|
|
|
],
|
|
|
'manual': [
|