From 88f62e2d6b72eb47052d64b67dcba795170c6374 Mon Sep 17 00:00:00 2001 From: Matlink Date: Tue, 19 Dec 2017 13:38:12 +0100 Subject: [PATCH] Fix regression #150 --- gplaycli/gplaycli.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/gplaycli/gplaycli.py b/gplaycli/gplaycli.py index f69dc3b..52b38fe 100755 --- a/gplaycli/gplaycli.py +++ b/gplaycli/gplaycli.py @@ -212,19 +212,19 @@ def connect_to_googleplay_api(self): logger.info("Using auto retrieved token to connect to API") authSubToken = self.token gsfId = int(self.gsfid, 16) - try: - with warnings.catch_warnings(): - warnings.simplefilter('error') - try: - self.playstore_api.login(email=email, - password=password, - authSubToken=authSubToken, - gsfId=gsfId) - except SystemError: - raise LoginError("Token has expired, leading to invalid response size") - except (ValueError, IndexError, LoginError, DecodeError) as ve: # invalid token or expired - logger.info("Token has expired or is invalid. Retrieving a new one...") - self.refresh_token() + with warnings.catch_warnings(): + warnings.simplefilter('error') + try: + self.playstore_api.login(email=email, + password=password, + authSubToken=authSubToken, + gsfId=gsfId) + except LoginError as le: + logger.error("Bad authentication, login or password incorrect (%s)" % le) + return False, ERRORS.CANNOT_LOGIN_GPLAY + except (ValueError, IndexError, LoginError, DecodeError, SystemError) as ve: # invalid token or expired + logger.info("Token has expired or is invalid. Retrieving a new one...") + self.refresh_token() success = True return success, error