Search code examples
pythongoogle-apigoogle-api-client

How to find out Google API related method


I need to get the stars amount on apps, and I found this Google API

https://developers.google.com/android-publisher/reply-to-reviews#retrieving_a_set_of_reviews

But I am going to do it server to server, therefore I use server account solution

https://developers.google.com/identity/protocols/OAuth2ServiceAccount

This example is for sqladmin, I don't know where to get androidpublisher's sample, here is my code

from google.oauth2 import service_account

SCOPES = ['https://www.googleapis.com/auth/androidpublisher']
SERVICE_ACCOUNT_FILE = 'account.json'

credentials = service_account.Credentials.from_service_account_file(
    SERVICE_ACCOUNT_FILE, scopes=SCOPES)

from apiclient.discovery import build

try:
    service = build('androidpublisher', 'v2', credentials=credentials)
except Exception as e:
    print(str(e))

Nothing went wrong so far, I just need to know what is the next step to achieve this GET https://www.googleapis.com/androidpublisher/v2/applications/your_package_name/reviews? access_token=your_auth_token


Solution

  • It looks like your trying to access the Review.list() method.

    Try putting this after your value for service

    reviews_list = service.reviews().list(packageName=package_name).execute()
    

    For reference there is a similar example in the python directory of the android-play-publisher-api repository.

    A similar method is run at this point in the code for the Edits.apks: list method