我已经完成的步骤-
我试图用来访问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中做到吗? 我错过了哪一步?
它显示打印时的评论资源,但不获取评论