Commit Graph

37 Commits

Author SHA1 Message Date
Domenico Iezzi
c61819d00b
Fix #22
Now gpapi checks if the locale retrieved from system or provided by the
user is valid. In case it's invalid, default to en_US.
2017-11-13 11:44:15 +01:00
Domenico Iezzi
ac2d07a8c9
Some code optimizations
Changed nested for loops with list comprehensions and maps. Also some
small fixes to indentation
2017-11-11 21:59:14 +01:00
Domenico Iezzi
6a9f29c6ce
Device info setup moved inside __init__
Since most of the device data is used only for the checkin procedure,
which is run only after the first login with email and passwd, it
is useless to have functions in GooglePlayAPI to modify them at runtime.

Now if the user wants to specify custom data, this data should be
provided as arguments to the constructor.
2017-11-10 22:25:33 +01:00
Domenico Iezzi
693ae8348f
Take latest apk if not version specified
If no *versionCode* parameter is specified to *download* or *delivery*
methods, fetch the latest one with a simple `self.details(pkgName)`
2017-11-09 12:25:39 +01:00
Domenico Iezzi
639c7f9e98
Python code linting and cleanup 2017-11-07 14:02:23 +01:00
Domenico Iezzi
512dc4000f
Removed debug string 2017-11-05 15:56:53 +01:00
Domenico Iezzi
6a3926fcd6
search: fixed wrong doc check 2017-11-05 15:43:23 +01:00
Domenico Iezzi
11128cde27
search: manage case when no result is found 2017-11-05 12:58:38 +01:00
Domenico Iezzi
df2fa823fd
Fix #18
As described in play-store-api code [1] recenlty google introduced a Time
To Live to each auth token, which caused them to expire in a matter of
seconds. Moreover, in order to retrieve a long-ttl token, a second auth
request now is needed, sending the Master Token returned from the first
request. This 'second round' request will return the actual authSubToken.

Another addition is that the code now return response's text for some
generic errors, in order to help debugging those problems.
2017-11-03 11:35:50 +01:00
Domenico Iezzi
25bfb4aaec
bulkDetails: handle case when app doesn't exist
Now the function returns None if an app doesnt't exists. This does not
apply for details() function, which instead return a RequestError if the
app doesn't exist.
2017-11-02 17:34:49 +01:00
Domenico Iezzi
866c633b1c
Integrity check before returning lists
In order to catch invalid tokens, an additional integrity check is done
before returning lists in details() and bulkDetails() functions. If the
check doesn't pass, raise a LoginError.
2017-11-01 11:23:24 +01:00
Domenico Iezzi
e1acc14424
Dinamically change locale and timezone
During DeviceBuilder initialization, retrieve locale from system using
python `locale` module, and set timezone to `Europe/Berlin`. Added some
helpers to get and set those values at runtime.
2017-10-30 17:30:10 +01:00
Domenico Iezzi
0a7cca7be7
Throw right kind of error when token expired 2017-10-22 17:25:58 +02:00
Domenico Iezzi
5034244620 Build request params with current device data
Login and Auth parameters are built using device selected in
deviceBuilder object. Also got rid of an unused parameter client_sig.
2017-10-19 17:51:03 +02:00
Domenico Iezzi
dd2d7b64d1 Added timeout to requests
Signed-off-by: Domenico Iezzi <domenico.iezzi.201@gmail.com>
2017-10-19 13:14:27 +02:00
Domenico Iezzi
6857b15d45 Bool flag to control expansion files + cleanup
Signed-off-by: Domenico Iezzi <domenico.iezzi.201@gmail.com>
2017-10-17 17:57:31 +02:00
Domenico Iezzi
b3f28cb0c4 Download optional expansion files (obb files)
Signed-off-by: Domenico Iezzi <domenico.iezzi.201@gmail.com>
2017-10-17 11:41:39 +02:00
Domenico Iezzi
9d0d14450b Fix #16
Signed-off-by: Domenico Iezzi <domenico.iezzi.201@gmail.com>
2017-10-13 19:12:06 +02:00
Domenico Iezzi
2ab7ce09c6 Added bacon (OnePlus 1) as default device
Signed-off-by: Domenico Iezzi <domenico.iezzi.201@gmail.com>
2017-10-13 18:20:09 +02:00
Domenico Iezzi
d4fb3eba91 Fix #10, raise excpetion rather than sys.exit()
Signed-off-by: Domenico Iezzi <domenico.iezzi.201@gmail.com>
2017-10-13 17:00:10 +02:00
Domenico Iezzi
afe654111e Implemented #10
Signed-off-by: Domenico Iezzi <domenico.iezzi.201@gmail.com>
2017-10-13 11:20:40 +02:00
Domenico Iezzi
5bbdd195a1 Moved header string preparation to config.py
Signed-off-by: Domenico Iezzi <domenico.iezzi.201@gmail.com>
2017-10-12 19:46:20 +02:00
Domenico Iezzi
11de82f91a Added static method for getDeviceReadableNames
Signed-off-by: Domenico Iezzi <domenico.iezzi.201@gmail.com>
2017-10-10 19:23:58 +02:00
Domenico Iezzi
b8412dd68a review() function returns all fields
Signed-off-by: Domenico Iezzi <domenico.iezzi.201@gmail.com>
2017-10-10 18:55:03 +02:00
Domenico Iezzi
3b37b18542 Code style improvements, checked using flake8
Signed-off-by: Domenico Iezzi <domenico.iezzi.201@gmail.com>
2017-10-10 18:35:40 +02:00
Matlink
1b47fdbe19 Add ability to fake devices
Signed-off-by: Matlink <matlink@matlink.fr>
2017-10-09 22:18:36 +02:00
Domenico Iezzi
0cda029a52 improved review() response + added in test.py
Signed-off-by: Domenico Iezzi <domenico.iezzi.201@gmail.com>
2017-10-08 21:25:04 +02:00
Domenico Iezzi
052afcbb0b details() now return a dict, rather than pb object
Signed-off-by: Domenico Iezzi <domenico.iezzi.201@gmail.com>
2017-10-08 19:50:29 +02:00
Domenico Iezzi
dda3a2f39f Removed caching code + better search() behaviour
The old caching code could cause a query to be cached for ever,
returning always the same set of result for a specific query. This is
not a good behaviour, since search results change continuously. In the
future, this behaviour could be reintroduced with a better logic (for
example, check if the query was in cache longer than some hours or days)

Signed-off-by: Domenico Iezzi <domenico.iezzi.201@gmail.com>
2017-10-08 19:36:36 +02:00
Matlink
c6973ebd5f Fix progression slow down
Signed-off-by: Matlink <matlink@matlink.fr>
2017-10-08 14:43:53 +02:00
Matlink
79f02dd8ad Add ability to show download progression
Signed-off-by: Matlink <matlink@matlink.fr>
2017-10-07 18:59:23 +02:00
Domenico Iezzi
ed0c926dc5 Fix #8
Signed-off-by: Domenico Iezzi <domenico.iezzi.201@gmail.com>
2017-10-07 18:21:05 +02:00
Domenico Iezzi
cfc2de89ce Fixed browse() and list() functions + update test
Signed-off-by: Domenico Iezzi <domenico.iezzi.201@gmail.com>
2017-10-06 11:53:53 +02:00
Domenico Iezzi
a79c1556ab Fixed and improved browse() function
Signed-off-by: Domenico Iezzi <domenico.iezzi.201@gmail.com>
2017-10-05 21:51:43 +02:00
Domenico Iezzi
73081ee57a Fix #7
Signed-off-by: Domenico Iezzi <domenico.iezzi.201@gmail.com>
2017-10-05 20:39:24 +02:00
Domenico Iezzi
2276f8db2c Changed login() behaviour
Previously, the ac2dm was meant to be saved in the application state, and later used for
subsequent logins, along with the gsfId. This is not correct, because the app needs it
only for the first login, and then remains unused in the application state.

The correct behaviour is to save the gsfId and the authSubToken, and provide only these two
values for subsequent logins

Signed-off-by: Domenico Iezzi <domenico.iezzi.201@gmail.com>
2017-10-04 11:32:56 +02:00
Domenico Iezzi
1739425d35 Added setup.py + changes to the lib structure
Signed-off-by: Domenico Iezzi <domenico.iezzi.201@gmail.com>
2017-09-21 11:19:48 +02:00