googleplay-api/test.py
Domenico Iezzi fdb0d7e999 Try to fix travis build pt.2
Signed-off-by: Domenico Iezzi <domenico.iezzi.201@gmail.com>
2017-10-05 22:08:45 +02:00

58 lines
1.2 KiB
Python

from gpapi.googleplay import GooglePlayAPI
import sys
EMAIL = "maracaiboez"
PASSWD = "fjgozwjmkwyvvutt"
testApps = ['com.cpuid.cpu_z']
server = GooglePlayAPI(debug=True)
# LOGIN
print('\nLogging in with email and password\n')
server.login(EMAIL, PASSWD, None, None)
gsfId = server.gsfId
authSubToken = server.authSubToken
print('\nNow trying secondary login with ac2dm token and gsfId saved\n')
server = GooglePlayAPI(debug=True)
server.login(None, None, gsfId, authSubToken)
# SEARCH
apps = server.search('telegram', 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'])
# DOWNLOAD
docid = apps[0]['docId']
version = apps[0]['versionCode']
print('\nTelegram docid is: %s\n' % docid)
print('\nAttempting to download %s\n' % docid)
fl = server.download(docid, version)
with open(docid + '.apk', 'wb') as f:
f.write(fl)
print('\nDownload successful\n')
f.close()
# BULK DETAILS
print('\nGetting details for %s\n' % testApps[0])
bulk = server.bulkDetails(testApps)
print(bulk)
print()
# BROWSE
browse = server.browse(cat='MUSIC_AND_AUDIO')
for key in browse.keys():
print('First app for category %s is %s' % (key, browse[key][0]['docId']))