From 052afcbb0b30715770294fa5914dd0b8005851ef Mon Sep 17 00:00:00 2001 From: Domenico Iezzi Date: Sun, 8 Oct 2017 19:50:29 +0200 Subject: [PATCH] details() now return a dict, rather than pb object Signed-off-by: Domenico Iezzi --- gpapi/googleplay.py | 6 ++++-- test.py | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/gpapi/googleplay.py b/gpapi/googleplay.py index 60bdabf..b565a7d 100644 --- a/gpapi/googleplay.py +++ b/gpapi/googleplay.py @@ -305,10 +305,12 @@ class GooglePlayAPI(object): def details(self, packageName): """Get app details from a package name. + packageName is the app unique ID (usually starting with 'com.').""" path = "details?doc=%s" % requests.utils.quote(packageName) - message = self.executeRequestApi2(path) - return message.payload.detailsResponse + data = self.executeRequestApi2(path) + app = utils.fromDocToDictionary(data.payload.detailsResponse.docV2) + return app def bulkDetails(self, packageNames): """Get several apps details from a list of package names. diff --git a/test.py b/test.py index 746b66d..e3c3142 100644 --- a/test.py +++ b/test.py @@ -26,7 +26,6 @@ apps = server.search('termux', 34, None) print('nb_result: 34') print('number of results: %d' % len(apps)) - print('\nFound those apps:\n') for a in apps: print(a['docId']) @@ -68,10 +67,15 @@ if not errorThrown: # BULK DETAILS -print('\nGetting details for %s\n' % testApps[0]) +print('\nGetting bulkDetails for %s\n' % testApps[0]) bulk = server.bulkDetails(testApps) print(bulk) +# DETAILS +print('\nGetting details for %s\n' % testApps[0]) +details = server.details(testApps[0]) +print(details) + # BROWSE print('\nBrowse play store categories\n')