From 32f692974790f45eee02724e9a9532f4ba974f2f Mon Sep 17 00:00:00 2001 From: houhuan Date: Mon, 4 May 2026 22:53:23 +0800 Subject: [PATCH] fix: handle missing serviceToken cookie by validating response and alerting on token expiration --- save_token.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/save_token.py b/save_token.py index f431d7b..8566022 100644 --- a/save_token.py +++ b/save_token.py @@ -33,7 +33,12 @@ async def main(): sts_url = f"{location}&clientSign={client_sign}" async with s.get(sts_url, headers=headers) as r2: - service_token = r2.cookies.get("serviceToken", "").value + st_cookie = r2.cookies.get("serviceToken") + if not st_cookie: + print(f"❌ 错误:未能获取 serviceToken。请检查 PASS_TOKEN 是否过期。") + print(f"响应状态码: {r2.status}") + return + service_token = st_cookie.value token = { "deviceId": device_id,