mirror of
https://github.com/shufflewzc/faker2.git
synced 2025-04-23 02:48:44 +08:00
Update jd_identical.py
This commit is contained in:
parent
4bb8c56963
commit
b1efee82c4
@ -10,6 +10,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
logger = logging.getLogger(name=None) # 创建一个日志对象
|
logger = logging.getLogger(name=None) # 创建一个日志对象
|
||||||
@ -82,6 +83,17 @@ def get_index(lst: list, item: str) -> list:
|
|||||||
return [index for (index, value) in enumerate(lst) if value == item]
|
return [index for (index, value) in enumerate(lst) if value == item]
|
||||||
|
|
||||||
|
|
||||||
|
def getversion():
|
||||||
|
url = f"http://{ipport}/api/system"
|
||||||
|
response = requests.get(url=url)
|
||||||
|
data = json.loads(response.content.decode("utf-8"))
|
||||||
|
version = data.get("data").get("version")
|
||||||
|
if int(version.split('.')[0]) >= 2:
|
||||||
|
if int(version.split('.')[1]) >= 12:
|
||||||
|
return 1
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
def get_duplicate_list(tasklist: list) -> tuple:
|
def get_duplicate_list(tasklist: list) -> tuple:
|
||||||
logger.info("\n=== 第一轮初筛开始 ===")
|
logger.info("\n=== 第一轮初筛开始 ===")
|
||||||
|
|
||||||
@ -89,7 +101,14 @@ def get_duplicate_list(tasklist: list) -> tuple:
|
|||||||
names = []
|
names = []
|
||||||
cmds = []
|
cmds = []
|
||||||
for task in tasklist:
|
for task in tasklist:
|
||||||
ids.append(task.get("_id"))
|
url = f"http://{ipport}/api/system"
|
||||||
|
response = requests.get(url=url)
|
||||||
|
data = json.loads(response.content.decode("utf-8"))
|
||||||
|
version = data.get("data").get("version")
|
||||||
|
if getversion() == 1:
|
||||||
|
ids.append(task.get("id"))
|
||||||
|
else:
|
||||||
|
ids.append(task.get("_id"))
|
||||||
names.append(task.get("name"))
|
names.append(task.get("name"))
|
||||||
cmds.append(task.get("command"))
|
cmds.append(task.get("command"))
|
||||||
|
|
||||||
@ -154,17 +173,9 @@ def disable_duplicate_tasks(ids: list) -> None:
|
|||||||
|
|
||||||
def get_token() -> str or None:
|
def get_token() -> str or None:
|
||||||
try:
|
try:
|
||||||
url = f"http://{ipport}/api/system"
|
if getversion() == 1:
|
||||||
response = requests.get(url=url)
|
with open("/ql/data/config/auth.json", "r", encoding="utf-8") as f:
|
||||||
data = json.loads(response.content.decode("utf-8"))
|
data = json.load(f)
|
||||||
version=data.get("data").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:
|
else:
|
||||||
with open("/ql/config/auth.json", "r", encoding="utf-8") as f:
|
with open("/ql/config/auth.json", "r", encoding="utf-8") as f:
|
||||||
data = json.load(f)
|
data = json.load(f)
|
||||||
|
Loading…
Reference in New Issue
Block a user