fix: allow sentinel runtime account sync responses

This commit is contained in:
Codex
2026-06-13 10:28:04 +00:00
parent 8008a4977d
commit cfedce2702
@@ -788,9 +788,17 @@ class Sub2ApiAdmin:
def request(self, method, path, payload=None):
token = self.login()
headers = {"Authorization": "Bearer " + token, "Content-Type": "application/json"}
resp = http_json(method, self.base + path, headers, payload, timeout=20)
resp = http_json(method, self.base + path, headers, payload, timeout=20, max_bytes=2 * 1024 * 1024)
if not resp["ok"]:
raise RuntimeError(f"admin {method} {path} failed: {resp.get('status')} {preview(resp.get('text', ''), 300)}")
parsed = resp.get("json")
code = parsed.get("code") if isinstance(parsed, dict) else None
message = parsed.get("message") if isinstance(parsed, dict) else None
detail = f"status={resp.get('status')} tooLarge={resp.get('tooLarge')}"
if code is not None:
detail += f" code={code}"
if message:
detail += f" message={preview(message, 200)}"
raise RuntimeError(f"admin {method} {path} failed: {detail}")
parsed = resp.get("json")
if isinstance(parsed, dict) and parsed.get("code") not in (None, 0):
raise RuntimeError(f"admin {method} {path} failed: code={parsed.get('code')} message={parsed.get('message')}")