mirror of
https://github.com/FliegendeWurst/googleplay-api.git
synced 2024-11-22 12:54:58 +00:00
Added functions to change locale
Locale and Timezone can be changed even during a session, and results will change accordingly
This commit is contained in:
parent
2e4166f4e5
commit
7f0fad78ef
@ -48,7 +48,7 @@ class DeviceBuilder(object):
|
|||||||
for (key, value) in config.items(device):
|
for (key, value) in config.items(device):
|
||||||
self.device[key] = value
|
self.device[key] = value
|
||||||
|
|
||||||
def setLocale(self, locale):
|
def set_locale(self, locale):
|
||||||
# test if provided locale is valid
|
# test if provided locale is valid
|
||||||
if locale is None or type(locale) is not str:
|
if locale is None or type(locale) is not str:
|
||||||
raise Exception('Wrong locale supplied')
|
raise Exception('Wrong locale supplied')
|
||||||
|
@ -53,7 +53,13 @@ class GooglePlayAPI(object):
|
|||||||
self.debug = debug
|
self.debug = debug
|
||||||
self.proxies_config = proxies_config
|
self.proxies_config = proxies_config
|
||||||
self.deviceBuilder = config.DeviceBuilder(device_codename)
|
self.deviceBuilder = config.DeviceBuilder(device_codename)
|
||||||
self.deviceBuilder.setLocale(locale)
|
self.set_locale(locale)
|
||||||
|
self.set_timezone(timezone)
|
||||||
|
|
||||||
|
def set_locale(self, locale):
|
||||||
|
self.deviceBuilder.set_locale(locale)
|
||||||
|
|
||||||
|
def set_timezone(self, timezone):
|
||||||
self.deviceBuilder.set_timezone(timezone)
|
self.deviceBuilder.set_timezone(timezone)
|
||||||
|
|
||||||
def encrypt_password(self, login, passwd):
|
def encrypt_password(self, login, passwd):
|
||||||
|
4
test.py
4
test.py
@ -9,7 +9,7 @@ ap.add_argument('-p', '--password', dest='password', help='google password')
|
|||||||
|
|
||||||
args = ap.parse_args()
|
args = ap.parse_args()
|
||||||
|
|
||||||
server = GooglePlayAPI(debug=True, locale='it_IT', timezone='Europe/Rome')
|
server = GooglePlayAPI('it_IT', 'Europe/Rome', debug=True)
|
||||||
|
|
||||||
# LOGIN
|
# LOGIN
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ gsfId = server.gsfId
|
|||||||
authSubToken = server.authSubToken
|
authSubToken = server.authSubToken
|
||||||
|
|
||||||
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 = GooglePlayAPI(debug=True, locale='it_IT', timezone='Europe/Rome')
|
server = GooglePlayAPI('it_IT', 'Europe/Rome', debug=True)
|
||||||
server.login(None, None, gsfId, authSubToken)
|
server.login(None, None, gsfId, authSubToken)
|
||||||
|
|
||||||
# SEARCH
|
# SEARCH
|
||||||
|
Loading…
Reference in New Issue
Block a user