完成 Ruff 全量清理
This commit is contained in:
@@ -92,7 +92,7 @@ class WSConnectParaInfo(TafStruct):
|
||||
|
||||
def _gen_trace_id() -> str:
|
||||
"""生成 sTraceId (格式 hex8:hex8:0:0,HAR 实证)"""
|
||||
h = "%016x" % random.getrandbits(64)
|
||||
h = f"{random.getrandbits(64):016x}"
|
||||
return f"{h}:{h}:0:0"
|
||||
|
||||
|
||||
@@ -294,7 +294,7 @@ class HuyaHttpClient:
|
||||
import gzip
|
||||
|
||||
resp_data = gzip.decompress(resp_data)
|
||||
except Exception as e:
|
||||
except Exception as e: # noqa: BLE001 外部接口与任务边界需要保留宽泛异常兜底
|
||||
self.logger(f"[HTTP] ❌ 请求失败: {type(e).__name__}: {e}")
|
||||
return None
|
||||
|
||||
@@ -611,13 +611,13 @@ class HuyaHttpClient:
|
||||
or resp.headers.get("Content-Encoding") == "gzip"
|
||||
):
|
||||
resp_data = gzip.decompress(resp_data)
|
||||
except Exception as e:
|
||||
except Exception as e: # noqa: BLE001 外部接口与任务边界需要保留宽泛异常兜底
|
||||
self.logger(f"[LIVELINK] ❌ 小程序码请求失败: {type(e).__name__}: {e}")
|
||||
return None
|
||||
|
||||
try:
|
||||
data = json.loads(resp_data.decode("utf-8", "replace"))
|
||||
except Exception as e:
|
||||
except Exception as e: # noqa: BLE001 外部接口与任务边界需要保留宽泛异常兜底
|
||||
self.logger(f"[LIVELINK] ❌ 小程序码响应解析失败: {type(e).__name__}: {e}")
|
||||
return None
|
||||
|
||||
@@ -679,13 +679,13 @@ class HuyaHttpClient:
|
||||
or resp.headers.get("Content-Encoding") == "gzip"
|
||||
):
|
||||
resp_data = gzip.decompress(resp_data)
|
||||
except Exception as e:
|
||||
except Exception as e: # noqa: BLE001 外部接口与任务边界需要保留宽泛异常兜底
|
||||
self.logger(f"[LIVELINK] ❌ 二维码状态请求失败: {type(e).__name__}: {e}")
|
||||
return None
|
||||
|
||||
try:
|
||||
data = json.loads(resp_data.decode("utf-8", "replace"))
|
||||
except Exception as e:
|
||||
except Exception as e: # noqa: BLE001 外部接口与任务边界需要保留宽泛异常兜底
|
||||
self.logger(
|
||||
f"[LIVELINK] ❌ 二维码状态响应解析失败: {type(e).__name__}: {e}"
|
||||
)
|
||||
@@ -972,7 +972,7 @@ class HuyaHttpClient:
|
||||
import gzip
|
||||
|
||||
resp_data = gzip.decompress(resp_data)
|
||||
except Exception as e:
|
||||
except Exception as e: # noqa: BLE001 外部接口与任务边界需要保留宽泛异常兜底
|
||||
self.logger(f"[HTTP] ❌ payOrderSubmitV5 失败: {e}")
|
||||
return None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user