A more detailed test.py

Signed-off-by: Domenico Iezzi <domenico.iezzi.201@gmail.com>
This commit is contained in:
Domenico Iezzi 2017-09-16 19:13:01 +02:00
parent 8d39d03304
commit 2a8ec84fc7

36
test.py
View File

@ -2,24 +2,28 @@ from googleplay import GooglePlayAPI
EMAIL = "" EMAIL = ""
PASSWD = "" PASSWD = ""
AC2DM = ""
GSFID = 0
testApps = ['com.cpuid.cpu_z']
server = GooglePlayAPI(True) server = GooglePlayAPI(True)
if AC2DM == "":
print('\nLogging in with email and password\n')
server.login(EMAIL, PASSWD, None, None) server.login(EMAIL, PASSWD, None, None)
print(server.search('firefox', 1, None).child[0]) ac2dmToken = server.ac2dmToken
print(server.bulkDetails(['com.mozilla.firefox'])) gsfId = server.gsfId
fl = server.download('com.cpuid.cpu_z', 23)
with open('com.cpuid.cpu_z.apk', 'wb') as f: print('\nNow trying secondary login with ac2dm token and gsfId saved\n')
f.write(fl) server.login(EMAIL, PASSWD, ac2dmToken, gsfId)
f.close()
else: app = server.search('telegram', 1, None).child[0]
server.gsfId = GSFID docid = app.docid
server.login(EMAIL, PASSWD, AC2DM, GSFID) version = app.details.appDetails.versionCode
print(server.search('firefox', 1, None).child[0]) print('\nFirefox docid is: %s\n' % docid)
print(server.bulkDetails(['com.mozilla.firefox'])) print('\nAttempting to download %s\n' % docid)
fl = server.download('com.cpuid.cpu_z', 23) fl = server.download(docid, version)
with open('com.cpuid.cpu_z.apk', 'wb') as f: with open(docid + '.apk', 'wb') as f:
f.write(fl) f.write(fl)
print('\nDownload successful\n')
f.close() f.close()
print('\nGetting details for %s\n' % testApps[0])
bulk = server.bulkDetails(testApps)
print(bulk)