代码之家  ›  专栏  ›  技术社区  ›  Chan

如何找到Google API相关方法

  •  0
  • Chan  · 技术社区  · 8 年前

    我需要在应用程序上获取星星数,我找到了这个谷歌API

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

    但我要做的是服务器到服务器,因此我使用服务器帐户解决方案

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

    这个例子是针对sqladmin的,我不知道从哪里可以得到 androidpublisher 的示例,这是我的代码

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

    到目前为止还没有出什么问题,我只想知道下一步要做什么 GET https://www.googleapis.com/androidpublisher/v2/applications/your_package_name/reviews? access_token=your_auth_token

    1 回复  |  直到 8 年前
        1
  •  1
  •   ScottMcC    8 年前

    看起来您正在尝试访问 Review.list() 方法

    尝试将此放在您的价值之后 service

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

    作为参考,在 android-play-publisher-api 存储库。

    类似的方法运行于 this point 在代码中 Edits.apks: list 方法