type: 收敛测试 schemas 与协议层类型
This commit is contained in:
@@ -42,9 +42,17 @@ def check_douyu_cookie(cookie: str) -> dict:
|
||||
).json()
|
||||
if isinstance(fish_data, dict) and fish_data.get("error") in (0, "0"):
|
||||
fish_ok = True
|
||||
fish_ball = (fish_data.get("data") or {}).get("count") if isinstance(fish_data.get("data"), dict) else None
|
||||
fish_ball = (
|
||||
(fish_data.get("data") or {}).get("count")
|
||||
if isinstance(fish_data.get("data"), dict)
|
||||
else None
|
||||
)
|
||||
else:
|
||||
fish_msg = str(fish_data.get("msg") or fish_data.get("error") or "响应异常") if isinstance(fish_data, dict) else "响应异常"
|
||||
fish_msg = (
|
||||
str(fish_data.get("msg") or fish_data.get("error") or "响应异常")
|
||||
if isinstance(fish_data, dict)
|
||||
else "响应异常"
|
||||
)
|
||||
except Exception as exc:
|
||||
fish_msg = f"请求失败: {exc}"
|
||||
|
||||
@@ -66,11 +74,16 @@ def check_douyu_cookie(cookie: str) -> dict:
|
||||
).json()
|
||||
if isinstance(level_data, dict) and level_data.get("error") in (0, "0"):
|
||||
level_ok = True
|
||||
info = level_data.get("data") if isinstance(level_data.get("data"), dict) else {}
|
||||
info_raw = level_data.get("data")
|
||||
info = info_raw if isinstance(info_raw, dict) else {}
|
||||
nickname = str(info.get("nn") or "") or None
|
||||
level = info.get("lv")
|
||||
else:
|
||||
level_msg = str(level_data.get("msg") or level_data.get("error") or "响应异常") if isinstance(level_data, dict) else "响应异常"
|
||||
level_msg = (
|
||||
str(level_data.get("msg") or level_data.get("error") or "响应异常")
|
||||
if isinstance(level_data, dict)
|
||||
else "响应异常"
|
||||
)
|
||||
except Exception as exc:
|
||||
level_msg = f"请求失败: {exc}"
|
||||
|
||||
@@ -78,10 +91,12 @@ def check_douyu_cookie(cookie: str) -> dict:
|
||||
if valid:
|
||||
message = "有效"
|
||||
else:
|
||||
message = ";".join([
|
||||
f"鱼丸接口: {'ok' if fish_ok else (fish_msg or '失败')}",
|
||||
f"等级接口: {'ok' if level_ok else (level_msg or '失败')}",
|
||||
])
|
||||
message = ";".join(
|
||||
[
|
||||
f"鱼丸接口: {'ok' if fish_ok else (fish_msg or '失败')}",
|
||||
f"等级接口: {'ok' if level_ok else (level_msg or '失败')}",
|
||||
]
|
||||
)
|
||||
return {
|
||||
**base,
|
||||
"valid": valid,
|
||||
|
||||
Reference in New Issue
Block a user