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 = ""
PASSWD = ""
AC2DM = ""
GSFID = 0
testApps = ['com.cpuid.cpu_z']
server = GooglePlayAPI(True)
if AC2DM == "":
print('\nLogging in with email and password\n')
server.login(EMAIL, PASSWD, None, None)
print(server.search('firefox', 1, None).child[0])
print(server.bulkDetails(['com.mozilla.firefox']))
fl = server.download('com.cpuid.cpu_z', 23)
with open('com.cpuid.cpu_z.apk', 'wb') as f:
f.write(fl)
f.close()
else:
server.gsfId = GSFID
server.login(EMAIL, PASSWD, AC2DM, GSFID)
print(server.search('firefox', 1, None).child[0])
print(server.bulkDetails(['com.mozilla.firefox']))
fl = server.download('com.cpuid.cpu_z', 23)
with open('com.cpuid.cpu_z.apk', 'wb') as f:
ac2dmToken = server.ac2dmToken
gsfId = server.gsfId
print('\nNow trying secondary login with ac2dm token and gsfId saved\n')
server.login(EMAIL, PASSWD, ac2dmToken, gsfId)
app = server.search('telegram', 1, None).child[0]
docid = app.docid
version = app.details.appDetails.versionCode
print('\nFirefox 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()
print('\nGetting details for %s\n' % testApps[0])
bulk = server.bulkDetails(testApps)
print(bulk)