首页 > 解决方案 > 尝试查看评级时权限不足,使用 google play console api 对我的应用程序的评论

问题描述

我已经完成的步骤-

  1. 我通过单击链接按钮将我的项目链接到谷歌控制台 Api 中。
  2. 创建了一个服务帐户并生成了密钥以及一个 json 文件以进行访问。
  3. 授予我邮件帐户所有者的权限,以便我可以检索我的应用程序的评分和评论。

我试图用来访问python中的评级和评论的代码如下。

from httplib2 import Http
from oauth2client.service_account import ServiceAccountCredentials
from apiclient.discovery import build

credentials = ServiceAccountCredentials.from_json_keyfile_name(
    '<secret from service account>.json',
    scopes=['https://www.googleapis.com/auth/androidpublisher'])

service = build('androidpublisher', 'v2', http=credentials.authorize(Http()))

package_name = "<package name>"
reviews_resource = service.reviews()
reviews_page = reviews_resource.list(packageName=package_name, maxResults=100).execute()

但我总是在最后一行得到同样的错误。

HttpError: <HttpError 401 when requesting https://www.googleapis.com/androidpublisher/v2/applications/com.policybazaar/reviews?alt=json&maxResults=10 returned "The current user has insufficient permissions to perform the requested operation.">

我做错了什么?无法猜测?有人可以告诉如何在 python 中做到这一点吗?我错过了什么步骤?

它在打印时显示评论资源但不获取评论

标签: pythongoogle-play-consolegoogle-play-developer-api

解决方案


推荐阅读