Skip to main content

A Python client for Google Play authentication, metadata, and APK delivery.

Project description

googleplay-python

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.

Status

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.

Installation

pip install googleplay-python

For development:

pip install -e .[test]

Quick Start

Exchange an OAuth cookie for an AAS token

from googleplay import TokenExchangeClient

client = TokenExchangeClient()
aas_token = client.request_aas_token(
    email="account@example.com",
    oauth_token="oauth2_4/...",
)
print(aas_token)

Log in and fetch app details

from googleplay import GooglePlayClient

client = GooglePlayClient(
    email="account@example.com",
    aas_token="your-aas-token",
    device_codename="px_9a",
)
client.login()

details = client.details("com.google.android.calculator")
print(details["details"]["appDetails"]["versionString"])

Download an APK

from pathlib import Path

from googleplay import GooglePlayClient

client = GooglePlayClient(
    email="account@example.com",
    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)

Web search and public details

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"])

AAS Token Setup

The authenticated client expects an AAS token, not a Google password.

A common flow is:

  1. Open https://accounts.google.com/EmbeddedSetup in a browser.
  2. Complete the sign-in flow.
  3. Capture the oauth_token response cookie value.
  4. Exchange that one-time token with TokenExchangeClient.

The EmbeddedSetup flow and the token exchange are unofficial and may change.

Devices

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.

Testing

Run the offline test suite with:

pytest

Live tests are opt-in and require credentials:

export GOOGLEPLAY_TEST_EMAIL='account@example.com'
export GOOGLEPLAY_TEST_AAS_TOKEN='your-aas-token'
pytest tests/test_live.py

Optional live-test settings:

export GOOGLEPLAY_TEST_DEVICE='px_9a'
export GOOGLEPLAY_TEST_LOCALE='en_US'
export GOOGLEPLAY_TEST_TIMEZONE='UTC'

Caveats

  • 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.

Provenance

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.

License

This repository is licensed under GPL-3.0-only. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

googleplay_python-0.1.0.tar.gz (110.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

googleplay_python-0.1.0-py3-none-any.whl (109.2 kB view details)

Uploaded Python 3

File details

Details for the file googleplay_python-0.1.0.tar.gz.

File metadata

  • Download URL: googleplay_python-0.1.0.tar.gz
  • Upload date:
  • Size: 110.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for googleplay_python-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cdcbb55eb392fa99706937baa6485716545b8640ebae0b43fbd21679ae3889f4
MD5 8c686b96a0d30f4f99c9feda3bb7fbaa
BLAKE2b-256 b34b514c5d4079a9f85b6629cadb1e397006912eeca15a47becf0231c8ae738c

See more details on using hashes here.

File details

Details for the file googleplay_python-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for googleplay_python-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 551893b8f89cdbb67a2b47493ecad5fe6757cc9f2079ca21b44055dd4141b753
MD5 9bec970583389e23c5051c962f79490c
BLAKE2b-256 f44723144f12d35c60126bb5ca6b13102a2870ceeb87243a0e63fc4d9c3d459c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page