Socket
Socket
Sign inDemoInstall

python-gpapi2

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

python-gpapi2

An unofficial Python API that let you search, browse and download Android apps from Google Play Store


Maintainers
1

python-gpapi2

GitHub Actions PyPI

An unofficial Python API that let you search, browse and download Android apps from Google Play Store.

Installation

pip install python-gpapi2

Usage

[!IMPORTANT] Currently, this API is still in development. The API may change in the future.

Many features are not yet implemented at this time, I will continue to work on it.

from gpapi2 import GooglePlayAPI

gpapi = GooglePlayAPI(email="example@gmail.com")
# See README.md section "Obtaining the Google Play Store token" for more information
gpapi.login(aas_token="aas_et/AKpp...")

# Get the details of an app
# NOTE: The method currently returns a JSON string, you can use the
# `json.loads` to convert it to a Python dictionary. I will change it
# to return a user-friendly object in the future.
details = gpapi.details("com.whatsapp")

# Get the version of an app
version, version_code = gpapi.latest_version("com.whatsapp")

# Get the download link of an app
download_link = gpapi.download_url("com.whatsapp", version_code)

Obtaining the Google Play Store token

[!IMPORTANT] Please ensure to protect the OAuth Token or AAS Token obtained below and do not disclose it to anyone, as this could put your Google account at risk.

To use this API, you need to obtain a Google Play Store token. You can do this by following these steps:

  1. First, you need to obtain an OAuth token. You can do this by opening the following URL in your browser:

    https://accounts.google.com/embedded/setup/v2/android

    And then:

    • Open the developer console in your browser (F12)

    • Log in with your Google account on the page that appears.

    • If the Google Terms of Services page appears, accept it. (It can hang up but it's normal)

    • Go to the Application tab of the developer console.

    • Expand the Cookies section and select the https://accounts.google.com entry.

    • There should be a cookie named oauth_token. Copy its value. This is your OAuth token. (It should look like oauth2_4/0AdL...)

    • This token can be used only once.

  2. Then, you need to obtain an AAS token. Run the following code:

    from gpapi2 import GooglePlayAPI
    
    email = "example@gmail.com"
    oauth_token = "oauth2_4/0AdL..."
    aas_token = GooglePlayAPI.request_aas_token(email, oauth_token)
    print(aas_token)
    

    You should see a long string of characters. This is your AAS token. It should looks like this: aas_et/AKpp...j25Q

License

This project is licensed under the MIT License or the Apache License 2.0, at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc