This release is a pre-release and may not be stable for production use.
GPSOauth Compatibility Layer
gpsoauth compatibility layer for google-api-python-client
Use Google Play Services authentication provided by gpsoauth with public Google APIs provided by google-api-python-client.
Google Play Services authenticated accounts are sometimes given special permissions, even on public APIs. This project thus aims to reduce the need for maintaining scattered wrappers around privileged private APIs when public APIs give the same privileges with gpsoauth-provided tokens.
This mini-library aims to pose as the many Android apps that Google allows access to its API. Unfortunately, not all API scopes are available for consumption on Android applications. A comprehensive list of unavailable scopes is being worked on. In the meantime, consider using Google's recommended flow of authentication for the scopes that are unavailable on any of Google's Android applications.
Usage
See https://github.com/rukins/gpsoauth-java#receiving-an-authentication-token for obtaining your account's oauth token.
from googleapiclient.discovery import build
from gpsoauth_compat import GPLogin
SCOPES = ['https://www.googleapis.com/auth/drive.metadata.readonly']
API_SERVICE_NAME = 'drive'
API_VERSION = 'v3'
OAUTH_TOKEN = 'SECRET_GOES_HERE'
flow = GPLogin.from_oauth_token(OAUTH_TOKEN, SCOPES)
# alternatively use the following line if you already have authenticated before
# flow = GPLogin.from_master_token(MASTER_TOKEN, SCOPES)
credentials = flow.credentials
service = build(API_SERVICE_NAME, API_VERSION, credentials = credentials)
print(service.files().list().execute())
[!WARNING] To log-out and disable this token and all its derivatives, visit https://myaccount.google.com/device-activity and navigate to your desired account. From there, you will find a device with a small caption on it saying "Android device". Click on it and log out from it.
It may be associated with your browser's login session, so you will have to use a private/ incognito browsing session to access that webpage and log yourself out from your main browser. You may have to log in into your main browser again to continue using your account on it.
Metadata
Release files for gpsoauth-compat 0.1.0rc1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gpsoauth_compat-0.1.0rc1.tar.gz | 3.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gpsoauth_compat-0.1.0rc1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.0 kB
Release files / gpsoauth_compat-0.1.0rc1.tar.gz
| Download URL | gpsoauth_compat-0.1.0rc1.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5806ca412de0d9fc299d708ef4d9be05d5348cbf8ff069e0af64a170d5ea5dd5
|
|
BLAKE2b-256 checksum How to use checksums |
a0f42876cd2b78f9286e5b02dd05c5999e26e29c341a72227b994bc5352f110f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.0.1 CPython/3.12.6 Windows/11
|
Release files / gpsoauth_compat-0.1.0rc1-py3-none-any.whl
| Download URL | gpsoauth_compat-0.1.0rc1-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ce43c3d3280d2e283e4155e435e570483df31ac78a956c0892940b1bd7a97a09
|
|
BLAKE2b-256 checksum How to use checksums |
793731bc7de69ca335f837b7f69019e58eab47e8e489ee453064b5cb798252c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.0.1 CPython/3.12.6 Windows/11
|