fix: 失败账号按间隔重试,请求并发不再占满整段学习
This commit is contained in:
@@ -1354,8 +1354,15 @@ class EunivClient:
|
||||
response = self._request("POST", f"{YXT_API}/v1/customdiy/user/getuserinfobyid", content=b"")
|
||||
except SessionExpired:
|
||||
return False
|
||||
payload = response.json()
|
||||
return isinstance(payload, dict) and bool(payload.get("cnName"))
|
||||
if response.status_code >= 500 or response.status_code == 429:
|
||||
raise RuntimeError("学习平台暂时不可用")
|
||||
try:
|
||||
payload = response.json()
|
||||
except ValueError as exc:
|
||||
raise RuntimeError("学习平台暂时不可用") from exc
|
||||
if not isinstance(payload, dict):
|
||||
raise RuntimeError("学习平台暂时不可用")
|
||||
return bool(payload.get("cnName"))
|
||||
|
||||
def _pages(self, url: str, headers: dict, html: str, parse, identity: str) -> list[dict]:
|
||||
items = parse(html)
|
||||
|
||||
Reference in New Issue
Block a user