From c163a74a6adc37f8f19aef3f644313e7314aa7ba Mon Sep 17 00:00:00 2001 From: que <1131692+trover@user.noreply.gitee.com> Date: Wed, 10 Jan 2024 10:19:18 +0800 Subject: [PATCH] =?UTF-8?q?:alien:=20:bug:=20[jd=E8=AF=95=E7=94=A8]=20?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=96=B0=E7=89=88=E9=9D=92=E9=BE=99=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jd_try_notify.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/jd_try_notify.py b/jd_try_notify.py index 85dd9df..8013483 100644 --- a/jd_try_notify.py +++ b/jd_try_notify.py @@ -58,8 +58,17 @@ def printf(text): def get_remarkinfo(): url='http://127.0.0.1:5600/api/envs' try: - with open('/ql/config/auth.json', 'r') as f: - token=json.loads(f.read())['token'] + path = '/ql/config/auth.json' # 设置青龙 auth文件地址 + if not os.path.isfile(path): + path = '/ql/data/config/auth.json' # 尝试设置青龙 auth 新版文件地址 + if os.path.isfile(path): # 进行文件真值判断 + with open(path, "r") as file: # 上下文管理 + auth = file.read() # 读取文件 + file.close() # 关闭文件 + auth = json.loads(auth) # 使用 json模块读取 + # with open('/ql/config/auth.json', 'r') as f: + # token=json.loads(f.read())['token'] + token = auth["token"] # 提取 authkey headers={ 'Accept':'application/json', 'authorization':'Bearer '+token,