【发布时间】:2013-09-06 23:43:20
【问题描述】:
我在调用 Reports API 时遇到错误:
<HttpError 403 when requesting https://www.googleapis.com/admin/reports/v1/usage/users/all/dates/2013-08-01?alt=json&maxResults=1 returned "Caller does not have access to the customers reporting data.">
以前有人见过这个错误吗?我错过了什么? 我只是不明白为什么会显示或我应该检查什么。
问候。
编辑:
授权:
credentials = SignedJwtAssertionCredentials(
service_account_name='5163XXXXX@developer.gserviceaccount.com',
private_key=oauth2_private_key,
scope='https://www.googleapis.com/auth/admin.reports.usage.readonly')
# https://developers.google.com/api-client-library/python/guide/thread_safety
http = credentials.authorize(httplib2.Http())
service = apiclient.discovery.build('admin', 'reports_v1', http=http)
实际调用:
result = service.userUsageReport().get(
userKey='all',
date='2013-08-01',
maxResults=1).execute()
其他 API 可以正常使用该服务帐户。 'https://www.googleapis.com/auth/admin.reports.usage.readonly' 已正确添加到 OAuth2 域配置页面。
【问题讨论】:
-
您以谁身份进行身份验证? Google Apps 实例中的经销商或超级管理员?它有助于查看您的实际代码,而不仅仅是您遇到的错误。
-
嗨,杰。我正在编辑问题以显示一些代码...
标签: python google-api google-api-python-client google-admin-sdk