Skip to content

Commit 7f0fad7

Browse files
author
Domenico Iezzi
committed
Added functions to change locale
Locale and Timezone can be changed even during a session, and results will change accordingly
1 parent 2e4166f commit 7f0fad7

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

gpapi/config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def __init__(self, device):
4848
for (key, value) in config.items(device):
4949
self.device[key] = value
5050

51-
def setLocale(self, locale):
51+
def set_locale(self, locale):
5252
# test if provided locale is valid
5353
if locale is None or type(locale) is not str:
5454
raise Exception('Wrong locale supplied')

gpapi/googleplay.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,13 @@ def __init__(self, locale, timezone, debug=False, device_codename='bacon',
5353
self.debug = debug
5454
self.proxies_config = proxies_config
5555
self.deviceBuilder = config.DeviceBuilder(device_codename)
56-
self.deviceBuilder.setLocale(locale)
56+
self.set_locale(locale)
57+
self.set_timezone(timezone)
58+
59+
def set_locale(self, locale):
60+
self.deviceBuilder.set_locale(locale)
61+
62+
def set_timezone(self, timezone):
5763
self.deviceBuilder.set_timezone(timezone)
5864

5965
def encrypt_password(self, login, passwd):

test.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
args = ap.parse_args()
1111

12-
server = GooglePlayAPI(debug=True, locale='it_IT', timezone='Europe/Rome')
12+
server = GooglePlayAPI('it_IT', 'Europe/Rome', debug=True)
1313

1414
# LOGIN
1515

@@ -19,7 +19,7 @@
1919
authSubToken = server.authSubToken
2020

2121
print('\nNow trying secondary login with ac2dm token and gsfId saved\n')
22-
server = GooglePlayAPI(debug=True, locale='it_IT', timezone='Europe/Rome')
22+
server = GooglePlayAPI('it_IT', 'Europe/Rome', debug=True)
2323
server.login(None, None, gsfId, authSubToken)
2424

2525
# SEARCH

0 commit comments

Comments
 (0)