From d4fb3eba91e8902417a751412a0e6d80662ca219 Mon Sep 17 00:00:00 2001 From: Domenico Iezzi Date: Fri, 13 Oct 2017 17:00:10 +0200 Subject: [PATCH] Fix #10, raise excpetion rather than sys.exit() Signed-off-by: Domenico Iezzi --- gpapi/googleplay.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/gpapi/googleplay.py b/gpapi/googleplay.py index d5e992d..e2624d4 100644 --- a/gpapi/googleplay.py +++ b/gpapi/googleplay.py @@ -8,7 +8,6 @@ from Crypto.Cipher import PKCS1_OAEP from clint.textui import progress import requests -import sys import base64 import itertools @@ -178,10 +177,9 @@ class GooglePlayAPI(object): 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.")