mirror of
https://github.com/FliegendeWurst/googleplay-api.git
synced 2024-11-22 12:54:58 +00:00
Added exception handling in test file
Signed-off-by: Domenico Iezzi <domenico.iezzi.201@gmail.com>
This commit is contained in:
parent
171faefc60
commit
1cd3b7598b
16
config.py
16
config.py
@ -9,6 +9,10 @@ SEPARATOR = ";"
|
|||||||
LANG = "en_US"
|
LANG = "en_US"
|
||||||
GOOGLE_PUBKEY = "AAAAgMom/1a/v0lblO2Ubrt60J2gcuXSljGFQXgcyZWveWLEwo6prwgi3iJIZdodyhKZQrNWp5nKJ3srRXcUW+F1BD3baEVGcmEgqaLZUNBjm057pKRI16kB0YppeGx5qIQ5QjKzsR8ETQbKLNWgRY0QRNVz34kMJR3P/LgHax/6rmf5AAAAAwEAAQ=="
|
GOOGLE_PUBKEY = "AAAAgMom/1a/v0lblO2Ubrt60J2gcuXSljGFQXgcyZWveWLEwo6prwgi3iJIZdodyhKZQrNWp5nKJ3srRXcUW+F1BD3baEVGcmEgqaLZUNBjm057pKRI16kB0YppeGx5qIQ5QjKzsR8ETQbKLNWgRY0QRNVz34kMJR3P/LgHax/6rmf5AAAAAwEAAQ=="
|
||||||
|
|
||||||
|
# parse phone config from the file 'device.properties'.
|
||||||
|
# if you want to add another phone, just create another section in
|
||||||
|
# the file. Some configurations for common phones can be found here:
|
||||||
|
# https://github.com/yeriomin/play-store-api/tree/master/src/main/resources
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
filepath = os.path.join( os.path.dirname( os.path.realpath(__file__) ), 'device.properties')
|
filepath = os.path.join( os.path.dirname( os.path.realpath(__file__) ), 'device.properties')
|
||||||
config.read(filepath)
|
config.read(filepath)
|
||||||
@ -16,13 +20,15 @@ device = {}
|
|||||||
for (key, value) in config.items('angler'):
|
for (key, value) in config.items('angler'):
|
||||||
device[key] = value
|
device[key] = value
|
||||||
|
|
||||||
libList = device['sharedlibraries'].split(",")
|
|
||||||
featureList = device['features'].split(",")
|
|
||||||
localeList = device['locales'].split(",")
|
|
||||||
glList = device['gl.extensions'].split(",")
|
|
||||||
platforms = device['platforms'].split(",")
|
|
||||||
|
|
||||||
def getDeviceConfig():
|
def getDeviceConfig():
|
||||||
|
libList = device['sharedlibraries'].split(",")
|
||||||
|
featureList = device['features'].split(",")
|
||||||
|
localeList = device['locales'].split(",")
|
||||||
|
glList = device['gl.extensions'].split(",")
|
||||||
|
platforms = device['platforms'].split(",")
|
||||||
|
|
||||||
deviceConfig = googleplay_pb2.DeviceConfigurationProto()
|
deviceConfig = googleplay_pb2.DeviceConfigurationProto()
|
||||||
deviceConfig.touchScreen = int(device['touchscreen'])
|
deviceConfig.touchScreen = int(device['touchscreen'])
|
||||||
deviceConfig.keyboard = int(device['keyboard'])
|
deviceConfig.keyboard = int(device['keyboard'])
|
||||||
|
42
test.py
42
test.py
@ -1,32 +1,38 @@
|
|||||||
from googleplay import GooglePlayAPI
|
from googleplay import GooglePlayAPI
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
EMAIL = ""
|
EMAIL = ""
|
||||||
PASSWD = ""
|
PASSWD = ""
|
||||||
|
|
||||||
testApps = ['com.cpuid.cpu_z']
|
testApps = ['com.cpuid.cpu_z']
|
||||||
server = GooglePlayAPI(True)
|
server = GooglePlayAPI(True)
|
||||||
|
|
||||||
print('\nLogging in with email and password\n')
|
try:
|
||||||
server.login(EMAIL, PASSWD, None, None)
|
print('\nLogging in with email and password\n')
|
||||||
ac2dmToken = server.ac2dmToken
|
server.login(EMAIL, PASSWD, None, None)
|
||||||
gsfId = server.gsfId
|
ac2dmToken = server.ac2dmToken
|
||||||
|
gsfId = server.gsfId
|
||||||
|
|
||||||
print('\nNow trying secondary login with ac2dm token and gsfId saved\n')
|
print('\nNow trying secondary login with ac2dm token and gsfId saved\n')
|
||||||
server.login(EMAIL, PASSWD, ac2dmToken, gsfId)
|
server.login(EMAIL, PASSWD, ac2dmToken, gsfId)
|
||||||
|
|
||||||
apps = server.search('telegram', 1, None)
|
apps = server.search('telegram', 1, None)
|
||||||
print('\nFound those apps:\n')
|
print('\nFound those apps:\n')
|
||||||
for a in apps:
|
for a in apps:
|
||||||
print(a['docId'])
|
print(a['docId'])
|
||||||
docid = apps[0]['docId']
|
docid = apps[0]['docId']
|
||||||
version = apps[0]['versionCode']
|
version = apps[0]['versionCode']
|
||||||
print('\nTelegram docid is: %s\n' % docid)
|
print('\nTelegram 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)
|
||||||
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()
|
||||||
print('\nGetting details for %s\n' % testApps[0])
|
print('\nGetting details for %s\n' % testApps[0])
|
||||||
bulk = server.bulkDetails(testApps)
|
bulk = server.bulkDetails(testApps)
|
||||||
print(bulk)
|
print(bulk)
|
||||||
|
except Exception as e:
|
||||||
|
print(str(e))
|
||||||
|
sys.exit(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user