python - 尝试查看评级时权限不足,使用 google play console api 对我的应用程序的评论
问题描述
我已经完成的步骤-
- 我通过单击链接按钮将我的项目链接到谷歌控制台 Api 中。
- 创建了一个服务帐户并生成了密钥以及一个 json 文件以进行访问。
- 授予我邮件帐户所有者的权限,以便我可以检索我的应用程序的评分和评论。
我试图用来访问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 中做到这一点吗?我错过了什么步骤?
它在打印时显示评论资源但不获取评论
解决方案
推荐阅读
- jquery - 可调整大小的 div 的定位问题 - 有没有办法限制 .ui-resizable-se 的移动?
- c - 更快的文件和内存写入
- spring-boot - Spring Boot 属性未加载 2.1.5
- python - 当我使用 BS 下载图像列表时,如何使用 for 循环修改字符串中的变量?
- unity3d - 如何从 Hololens 空间网格中裁剪对象
- r - 我应该如何创建一个与另一个变量完全相反的二进制变量?
- python - 在 Python 中使用请求库创建请求数组
- java - 试图将水平回收视图嵌套到垂直回收视图中
- ionic3 - 使用 google cordova 登录后,我被带到“www.google.com”
- c# - c#如何让web浏览器自动加载一个url