From 3124bc7323d61ee9ccc3a16a773b119c4bbb832e Mon Sep 17 00:00:00 2001 From: libuke Date: Mon, 12 Jun 2023 02:15:39 +0800 Subject: [PATCH] fix bugs --- aliyundrive.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/aliyundrive.py b/aliyundrive.py index 4a9c9d1b..a38d9755 100644 --- a/aliyundrive.py +++ b/aliyundrive.py @@ -26,15 +26,15 @@ def handle_error(error_message: str) -> AliyundriveInfo: try: flag, user_name, access_token, message = self._get_access_token(token) if not flag: - return handle_error(info, f'get_access_token error: {message}') + return handle_error(f'get_access_token error: {message}') flag, signin_count, message = self._check_in(access_token) if not flag: - return handle_error(info, f'check_in error: {message}') + return handle_error(f'check_in error: {message}') flag, message = self._get_reward(access_token, signin_count) if not flag: - return handle_error(info, f'get_reward error: {message}') + return handle_error(f'get_reward error: {message}') info.success = True info.user_name = user_name @@ -61,7 +61,6 @@ def _get_access_token(self, token: str) -> tuple[bool, str, str, str]: payload = {'grant_type': 'refresh_token', 'refresh_token': token} response = requests.post(url, json=payload, timeout=5) - response.raise_for_status() data = response.json() if 'code' in data and data['code'] in ['RefreshTokenExpired', 'InvalidParameter.RefreshToken']: @@ -88,7 +87,6 @@ def _check_in(self, access_token: str) -> tuple[bool, int, str]: headers = {'Authorization': f'Bearer {access_token}'} response = requests.post(url, json=payload, params=params, headers=headers, timeout=5) - response.raise_for_status() data = response.json() if 'success' not in data: @@ -115,7 +113,6 @@ def _get_reward(self, access_token: str, sign_day: int) -> tuple[bool, str]: headers = {'Authorization': f'Bearer {access_token}'} response = requests.post(url, json=payload, params=params, headers=headers, timeout=5) - response.raise_for_status() data = response.json() if 'result' not in data: