一、青龙面板配置环境变量
1. 配置通知渠道,企业微信应用或者飞书

2. 变量名为 xmqb,值为抓包获取的两个参数,中间用 # 号分隔

二、添加脚本

import os
import time
import requests
import urllib3
import json
from datetime import datetime
from typing import Optional, Dict, Any, Union
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
class Notifier:
@staticmethod
def send(title: str, content: str):
"""通过青龙面板通知设置发送消息"""
notifier_type = os.environ.get("NOTIFY_TYPE", "").lower()
if not notifier_type:
print()
:
notifier_type:
Notifier.feishu_notify(title, content)
notifier_type:
Notifier.qywx_notify(title, content)
:
()
Exception e:
()
():
fskey = os.environ.get()
fskey:
()
webhook_url =
payload = {
: ,
: {
: {
: {
: title,
: [
[{: , : content}]
]
}
}
}
}
:
response = requests.post(
webhook_url,
headers={: },
data=json.dumps(payload),
timeout=,
verify=
)
response.status_code != :
()
:
resp_data = response.json()
resp_data.get() != :
()
:
()
Exception e:
()
():
qywx_am = os.environ.get()
qywx_am:
()
parts = qywx_am.split()
(parts) < :
()
corpid, corpsecret, touser, agentid, msg_type = parts[:]
token_url =
:
token_resp = requests.get(token_url, verify=).json()
token_resp.get() != :
()
access_token = token_resp.get()
Exception e:
()
send_url =
payload = {
: touser,
: agentid,
: msg_type == ,
}
msg_type == :
payload[] = {: }
:
payload[] = {
: [