NoMore201 / googleplay-api

Google Play Unofficial Python API
Other
410 stars 208 forks source link

KeyError: 'versionCode' #109

Closed detrout closed 4 years ago

detrout commented 4 years ago

On 2020 Jan 16 I tried updating and got the following stack trace

Traceback (most recent call last):
  File "/usr/bin/gplaycli", line 11, in <module>
    load_entry_point('GPlayCli==3.26', 'console_scripts', 'gplaycli')()
  File "/usr/lib/python3/dist-packages/gplaycli/gplaycli.py", line 709, in main
    cli.prepare_analyse_apks()
  File "/usr/lib/python3/dist-packages/gplaycli/gplaycli.py", line 502, in prepare_analyse_apks
    to_update = self.analyse_local_apks(list_of_apks, download_folder)
  File "/usr/lib/python3/dist-packages/gplaycli/hooks.py", line 9, in check_connection
    return function(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/gplaycli/gplaycli.py", line 536, in analyse_local_apks
    store_version_code = detail['versionCode']
KeyError: 'versionCode'

There are also warnings about "Failed to get the attribute with namespace" but I think that's a different issue.

After running the debugger It looks like the json was reorganized and the version code was moved.

For me it was in ['details']['appDetails']

--- gplaycli.py~    2019-09-05 14:24:23.000000000 -0700
+++ gplaycli.py 2020-01-16 10:06:47.116349845 -0800
@@ -534,5 +534,5 @@
                unavail_items.append(((packagename, filename), UNAVAIL))
                continue
-           store_version_code = detail['versionCode']
+           store_version_code = detail['details']['appDetails']['versionCode']

            # Compare
NoMore201 commented 4 years ago

This library parses the protobuf response as-is, so changes in the play store api must be managed by application developers (in this case gplaycli).

detrout commented 4 years ago

Oops wrong bug issue tracker. sorry.