From e8f6efdda98f28821d1496573f3f3007871c236b Mon Sep 17 00:00:00 2001 From: shitao <133397418@qq.com> Date: Thu, 22 Feb 2024 09:27:26 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D(main.py)?= =?UTF-8?q?=EF=BC=9A=E4=BD=BF=E7=94=A8.get()=E6=96=B9=E6=B3=95=E8=8E=B7?= =?UTF-8?q?=E5=8F=96access=5Ftoken=EF=BC=8C=E4=BB=A5=E9=98=B2=E6=AD=A2KeyE?= =?UTF-8?q?rror=20=20=20=E2=9C=A8=20=E5=8A=9F=E8=83=BD(main.py)=EF=BC=9A?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AF=B9access=5Ftoken=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=E7=9A=84=E6=A3=80=E6=9F=A5=EF=BC=8C=E5=B9=B6=E5=9C=A8token?= =?UTF-8?q?=E8=BF=87=E6=9C=9F=E6=97=B6=E8=BF=94=E5=9B=9E=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dailycheckin/aliyun/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dailycheckin/aliyun/main.py b/dailycheckin/aliyun/main.py index 09e2d1d..caea518 100755 --- a/dailycheckin/aliyun/main.py +++ b/dailycheckin/aliyun/main.py @@ -19,7 +19,7 @@ class AliYun(CheckIn): url = "https://auth.aliyundrive.com/v2/account/token" data = {"grant_type": "refresh_token", "refresh_token": refresh_token} response = requests.post(url=url, json=data).json() - access_token = response["access_token"] + access_token = response.get("access_token") return access_token def sign(self, access_token): @@ -62,6 +62,8 @@ class AliYun(CheckIn): def main(self): refresh_token = self.check_item.get("refresh_token") access_token = self.update_token(refresh_token) + if not access_token: + return [{"name": "阿里云盘", "value": "token 过期"}] msg = self.sign(access_token) msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg]) return msg