details() now return a dict, rather than pb object

Signed-off-by: Domenico Iezzi <domenico.iezzi.201@gmail.com>
This commit is contained in:
Domenico Iezzi 2017-10-08 19:50:29 +02:00
parent dda3a2f39f
commit 052afcbb0b
2 changed files with 10 additions and 4 deletions

View File

@ -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.

View File

@ -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')