A Python client for Google Play authentication, metadata, and APK delivery.
googleplay-python is an unofficial library for Google Play workflows that are
not covered by the public Play Developer APIs. It provides:
- OAuth cookie to AAS token exchange
- Google Play checkin and bearer-token login
- authenticated app details lookup
- authenticated APK and OBB delivery
- lightweight Play web search and public detail scraping
This library is aimed at automation and research use cases that need a Python API instead of shelling out to external tools.
The project is usable, but it is still early.
- The authenticated client is covered by unit tests and opt-in live tests.
- The web search/detail client is intentionally small and only extracts the fields used by the library's compatibility layer.
- Google can change private or undocumented endpoints at any time.
Treat the API as stable enough for integration work, but expect occasional maintenance when Google changes upstream behavior.
pip install googleplay-pythonFor development:
pip install -e .[test]from googleplay import TokenExchangeClient
client = TokenExchangeClient()
aas_token = client.request_aas_token(
email="[email protected]",
oauth_token="oauth2_4/...",
)
print(aas_token)from googleplay import GooglePlayClient
client = GooglePlayClient(
email="[email protected]",
aas_token="your-aas-token",
device_codename="px_9a",
)
client.login()
details = client.details("com.google.android.calculator")
print(details["details"]["appDetails"]["versionString"])from pathlib import Path
from googleplay import GooglePlayClient
client = GooglePlayClient(
email="[email protected]",
aas_token="your-aas-token",
)
client.login()
delivery = client.download("com.google.android.calculator")
apk_path = Path("calculator.apk")
with apk_path.open("wb") as handle:
for chunk in delivery["file"].iter_content(client.session):
if chunk:
handle.write(chunk)from googleplay import WebPlayClient
client = WebPlayClient(lang="en", country="us")
results = client.search("calculator", n_hits=5)
print(results[0]["appId"])
public_details = client.details("com.google.android.calculator")
print(public_details["developerEmail"])The authenticated client expects an AAS token, not a Google password.
A common flow is:
- Open
https://accounts.google.com/EmbeddedSetupin a browser. - Complete the sign-in flow.
- Capture the
oauth_tokenresponse cookie value. - Exchange that one-time token with
TokenExchangeClient.
The EmbeddedSetup flow and the token exchange are unofficial and may change.
The client ships with bundled Android device profiles and defaults to px_9a.
You can select a different bundled device with device_codename=... when you
construct GooglePlayClient.
Run the offline test suite with:
pytestLive tests are opt-in and require credentials:
export GOOGLEPLAY_TEST_EMAIL='[email protected]'
export GOOGLEPLAY_TEST_AAS_TOKEN='your-aas-token'
pytest tests/test_live.pyOptional live-test settings:
export GOOGLEPLAY_TEST_DEVICE='px_9a'
export GOOGLEPLAY_TEST_LOCALE='en_US'
export GOOGLEPLAY_TEST_TIMEZONE='UTC'- This is not an official Google library.
- Private Google Play endpoints can change without notice.
- Some workflows depend on account state, device profile, and Play terms.
- Use a dedicated account for automated testing.
This project is informed by prior Google Play client work, including older
Python gpapi implementations and newer Rust-based clients. The current code is
packaged as a standalone Python library with its own tests and bundled runtime
assets.
This repository is licensed under GPL-3.0-only. See LICENSE.