Skip to content

Instantly share code, notes, and snippets.

@gregtap
Last active April 30, 2019 12:25
Show Gist options
  • Save gregtap/cbd84ed9486e4a727b8d250909b3ae7e to your computer and use it in GitHub Desktop.
Save gregtap/cbd84ed9486e4a727b8d250909b3ae7e to your computer and use it in GitHub Desktop.
testing googleplay API
from googleapiclient.discovery import build
from oauth2client.service_account import ServiceAccountCredentials
import httplib2
http = httplib2.Http(timeout=30)
credentials = ServiceAccountCredentials.from_json_keyfile_name(
"credentials.json", "https://www.googleapis.com/auth/androidpublisher"
)
http = credentials.authorize(http)
service = build('androidpublisher', 'v3', http=http)
# android_in_app = service.purchases().products().get(packageName=package_name,
# productId="{}.{}".format(package_name, product, token=token)).execute()
products = service.inappproducts().list(packageName="mobile.chefclub.App").execute()
print("%s products" % len(products))
package_name = "mobile.chefclub.App"
token = "gepkfnlflefaghcnnioohhbd.AO-J1OyYB7ProV2FCuCZzxT4eh5Da47f3JsTqTxuJP-9oc4FkdJdOwA6RDwVGUQ9rJJUcDy3Y3Ffv_Rswmu4fbrt2lvjAsWzdGHMzFibog1OfLhHfxP0ru81W6Qjv5KdTpBMgtXs6tt6sd5eBxQjXCiWjmyVeLB__Q"
# The token provided to the user's device when the inapp product was purchased.
android_in_app = service.purchases().subscriptions().get(packageName=package_name,
subscriptionId="mobile.chefclub.test_premium_subscription",
token=token).execute()
print(android_in_app)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment