Skip to content

Commit

Permalink
Fix #10, raise excpetion rather than sys.exit()
Browse files Browse the repository at this point in the history
Signed-off-by: Domenico Iezzi <[email protected]>
  • Loading branch information
Domenico Iezzi committed Oct 13, 2017
1 parent afe6541 commit d4fb3eb
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions gpapi/googleplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from clint.textui import progress

import requests
import sys
import base64
import itertools

Expand Down Expand Up @@ -178,10 +177,9 @@ def login(self, email=None, password=None, gsfId=None, authSubToken=None, device
ac2dmToken = params["auth"]
elif "error" in params:
if "NeedsBrowser" in params["error"]:
print("\nsecurity check is needed, try to visit\n"
"https://accounts.google.com/b/0/DisplayUnlockCaptcha\n"
"if you use 2FA it is recommended to setup an app specific password\n")
sys.exit(1)
raise LoginError("Security check is needed, try to visit "
"https://accounts.google.com/b/0/DisplayUnlockCaptcha "
"to unlock, or setup an app-specific password")
raise LoginError("server says: " + params["error"])
else:
raise LoginError("Auth token not found.")
Expand Down

0 comments on commit d4fb3eb

Please sign in to comment.