mirror of
https://github.com/FliegendeWurst/googleplay-api.git
synced 2024-11-22 12:54:58 +00:00
test.py: fixed wrong method + added progressbar
Signed-off-by: Domenico Iezzi <domenico.iezzi.201@gmail.com>
This commit is contained in:
parent
73906b104e
commit
cb2dc79344
6
test.py
6
test.py
@ -36,7 +36,7 @@ docid = apps[0]['docId']
|
|||||||
version = apps[0]['versionCode']
|
version = apps[0]['versionCode']
|
||||||
print('\nTermux docid is: %s\n' % docid)
|
print('\nTermux docid is: %s\n' % docid)
|
||||||
print('\nAttempting to download %s\n' % docid)
|
print('\nAttempting to download %s\n' % docid)
|
||||||
fl = server.download(docid, version)
|
fl = server.download(docid, version, progress_bar=True)
|
||||||
with open(docid + '.apk', 'wb') as f:
|
with open(docid + '.apk', 'wb') as f:
|
||||||
f.write(fl)
|
f.write(fl)
|
||||||
print('\nDownload successful\n')
|
print('\nDownload successful\n')
|
||||||
@ -46,18 +46,20 @@ with open(docid + '.apk', 'wb') as f:
|
|||||||
# Attempting to download Nova Launcher Prime
|
# Attempting to download Nova Launcher Prime
|
||||||
# it should throw an error 'App Not Purchased'
|
# it should throw an error 'App Not Purchased'
|
||||||
|
|
||||||
|
print('\nAttempting to download "com.teslacoilsw.launcher.prime"\n')
|
||||||
errorThrown = False
|
errorThrown = False
|
||||||
try:
|
try:
|
||||||
app = server.search('nova launcher prime', 3, None)
|
app = server.search('nova launcher prime', 3, None)
|
||||||
app = filter(lambda x: x['docId'] == 'com.teslacoilsw.launcher.prime', app)
|
app = filter(lambda x: x['docId'] == 'com.teslacoilsw.launcher.prime', app)
|
||||||
app = list(app)[0]
|
app = list(app)[0]
|
||||||
fl = server.download(app['docId'], app['versionCode'])
|
fl = server.delivery(app['docId'], app['versionCode'], progress_bar=True)
|
||||||
with open(docid + '.apk', 'wb') as f:
|
with open(docid + '.apk', 'wb') as f:
|
||||||
f.write(fl)
|
f.write(fl)
|
||||||
print('\nDownload successful\n')
|
print('\nDownload successful\n')
|
||||||
f.close()
|
f.close()
|
||||||
except RequestError as e:
|
except RequestError as e:
|
||||||
errorThrown = True
|
errorThrown = True
|
||||||
|
print(e)
|
||||||
|
|
||||||
if not errorThrown:
|
if not errorThrown:
|
||||||
print('Download of previous app should have failed')
|
print('Download of previous app should have failed')
|
||||||
|
Loading…
Reference in New Issue
Block a user