feat: 增加管理后台的会话、配置和用户管理
This commit is contained in:
@@ -324,7 +324,7 @@ class EunivClient:
|
||||
block = payload.get("code") or {}
|
||||
return block.get("code") or "", block.get("msg") or "", payload.get("bo")
|
||||
|
||||
def login(self, manual: bool = False) -> dict:
|
||||
def login(self, manual: bool = False, auto_attempts: int = 3) -> dict:
|
||||
self.client.get(EUNIV + "/")
|
||||
self.client.post(
|
||||
f"{PORTAL}/zte-bmt-ucs-portalbff/oauth/validate",
|
||||
@@ -358,10 +358,14 @@ class EunivClient:
|
||||
raise RuntimeError(f"安全码检查失败:{check_message}")
|
||||
|
||||
self._cipher = encrypt_password(public_key, self.password)
|
||||
return self._login_with_jigsaw(manual, auto_attempts)
|
||||
|
||||
def _login_with_jigsaw(self, manual: bool, auto_attempts: int) -> dict:
|
||||
"""次数由调用方传入。只把拼图被拒绝计入自动次数,密码错误或网络失败不重试。"""
|
||||
if manual:
|
||||
self._load_jigsaw()
|
||||
raise ManualJigsaw(self.current_puzzle())
|
||||
for _ in range(3):
|
||||
for _ in range(auto_attempts):
|
||||
big, small, top = self._load_jigsaw()
|
||||
try:
|
||||
return self.submit_jigsaw(jigsaw_offset(big, small, top))
|
||||
|
||||
Reference in New Issue
Block a user