Skip to content

Commit

Permalink
Update to new API way to fake device
Browse files Browse the repository at this point in the history
Signed-off-by: Matlink <[email protected]>
  • Loading branch information
matlink committed Oct 13, 2017
1 parent 40c38e4 commit 789a72a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions gplaycli/gplaycli.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def __init__(self, args=None, credentials=None):
self.verbose = False
self.progress_bar = False
self.logging = False
self.device_codename = 'angler'
self.device_codename = 'bacon'

# if args are passed
else:
Expand Down Expand Up @@ -172,7 +172,7 @@ def set_download_folder(self, folder):
self.config["download_folder_path"] = folder

def connect_to_googleplay_api(self):
api = GooglePlayAPI()
api = GooglePlayAPI(device_codename=self.device_codename)
error = None
try:
if self.token is False:
Expand All @@ -187,10 +187,10 @@ def connect_to_googleplay_api(self):
elif self.config["keyring_service"] and HAVE_KEYRING == False:
print("You asked for keyring service but keyring package is not installed")
sys.exit(ERRORS.KEYRING_NOT_INSTALLED)
api.login(email=username, password=passwd, device_codename=self.device_codename)
api.login(email=username, password=passwd)
else:
logging(self, "Using token to connect to API")
api.login(authSubToken=self.token, gsfId=int(self.gsfid,16), device_codename=self.device_codename)
api.login(authSubToken=self.token, gsfId=int(self.gsfid,16))
except LoginError as exc:
error = exc.value
success = False
Expand All @@ -201,7 +201,7 @@ def connect_to_googleplay_api(self):
except (ValueError, IndexError) as ve: # invalid token or expired
logging(self, "Token has expired or is invalid. Retrieving a new one...")
self.retrieve_token(self.token_url, force_new=True)
api.login(authSubToken=self.token, gsfId=int(self.gsfid,16), device_codename=self.device_codename)
api.login(authSubToken=self.token, gsfId=int(self.gsfid,16))
success = True
return success, error

Expand Down Expand Up @@ -512,8 +512,8 @@ def main():
type=str, help="Update all APKs in a given folder")
parser.add_argument('-f', '--folder', action='store', dest='dest_folder', metavar="FOLDER", nargs=1,
type=str, default=".", help="Where to put the downloaded Apks, only for -d command")
parser.add_argument('-dc', '--device-codename', action='store', dest='device_codename', metavar="DEVICE_CODENAME", nargs=1,
type=str, default="angler", help="The device codename to fake", choices=GooglePlayAPI.getDevicesCodenames())
parser.add_argument('-dc', '--device-codename', action='store', dest='device_codename', metavar="DEVICE_CODENAME",
type=str, default="bacon", help="The device codename to fake", choices=GooglePlayAPI.getDevicesCodenames())
parser.add_argument('-t', '--token', action='store_true', dest='token', default=False, help='Instead of classical credentials, use the tokenize version')
parser.add_argument('-tu', '--token-url', action='store', dest='token_url', metavar="TOKEN_URL",
type=str, default="DEFAULT_URL", help="Use the given tokendispenser URL to retrieve a token")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def test_default_settings():
assert gpc.yes == False
assert gpc.verbose == False
assert gpc.progress_bar == False
assert gpc.device_codename == 'angler'
assert gpc.device_codename == 'bacon'

def test_connection_token():
gpc.token = True
Expand Down

0 comments on commit 789a72a

Please sign in to comment.