Skip to content

Commit

Permalink
Fix regression #150
Browse files Browse the repository at this point in the history
  • Loading branch information
matlink committed Dec 19, 2017
1 parent e78c75e commit 88f62e2
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions gplaycli/gplaycli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 88f62e2

Please sign in to comment.