Update jd_identical.py

This commit is contained in:
Hans155922 2022-08-11 06:48:46 +08:00 committed by GitHub
parent 22c70f94ff
commit 98b3bd2d14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,7 +10,6 @@ import os
import sys
import time
import traceback
import requests
logger = logging.getLogger(name=None) # 创建一个日志对象
@ -25,7 +24,7 @@ if not ipport:
logger.info(
"如果报错请在环境变量中添加你的真实 IP:端口\n名称IPPORT\t127.0.0.1:5700\n或在 config.sh 中添加 export IPPORT='127.0.0.1:5700'"
)
ipport = "localhost:5700"
ipport = "localhost:5600"
else:
ipport = ipport.lstrip("http://").rstrip("/")
sub_str = os.getenv("RES_SUB", "shufflewzc_faker2")
@ -155,6 +154,19 @@ def disable_duplicate_tasks(ids: list) -> None:
def get_token() -> str or None:
try:
url = f"http://{ipport}/api/system"
response = requests.get(url=url)
data = json.loads(response.content.decode("utf-8"))
datas = data.get("data")
version=datas.get("version")
if int(version.split('.')[0])>=2:
if int(version.split('.')[1])>=12:
with open("/ql/data/config/auth.json", "r", encoding="utf-8") as f:
data = json.load(f)
else:
with open("/ql/config/auth.json", "r", encoding="utf-8") as f:
data = json.load(f)
else:
with open("/ql/config/auth.json", "r", encoding="utf-8") as f:
data = json.load(f)
except Exception: