Fix audit findings in queue fairness and official account lifecycle
This commit is contained in:
@@ -42,13 +42,19 @@ class OfficialRPC:
|
||||
allow_redirects=False,
|
||||
)
|
||||
if response.status_code in (401, 403):
|
||||
self.disconnect()
|
||||
raise FlowError(
|
||||
E.UNAUTHORIZED, "Official account authentication required", 401
|
||||
E.OFFICIAL_AUTH_REQUIRED,
|
||||
"Official account authentication required",
|
||||
401,
|
||||
)
|
||||
payload = response.json()
|
||||
error = payload.get("error")
|
||||
if isinstance(error, dict) and error.get("message") == "请重新登陆":
|
||||
raise FlowError(E.UNAUTHORIZED, "Official account session expired", 401)
|
||||
self.disconnect()
|
||||
raise FlowError(
|
||||
E.OFFICIAL_AUTH_REQUIRED, "Official account session expired", 401
|
||||
)
|
||||
response.raise_for_status()
|
||||
if error or not isinstance(payload.get("result"), dict):
|
||||
raise ValueError()
|
||||
|
||||
Reference in New Issue
Block a user