0

我一直在尝试使用 Admin SDK Reports APIgoogle-api-python-client来审核我的 G Suite 用户的 Drive 使用情况。我需要知道他们一周使用了多少配额。问题是当我尝试搜索存在的特定用户时:

SCOPES = ['https://www.googleapis.com/auth/admin.reports.audit.readonly', 'https://www.googleapis.com/auth/admin.reports.usage.readonly', 'https://www.googleapis.com/auth/drive']
#I replaced the real values with example ones.
creds = ServiceAccountCredentials.from_p12_keyfile(filename="somefile.p12", service_account_email="someservice@mail.iam.gserviceaccount.com", scopes=SCOPES)
delegated_creds=creds.create_delegated('gsuiteowner@mail.com')
service = build('admin', 'reports_v1', credentials=delegated_creds)
results = service.userUsageReport().get(userKey="some@usermail.com",date="2020-08-27").execute()

我只得到两种类型的答案:第一种,当我尝试搜索过去 7 天的数据时出现 PARTIAL_DATA_AVAILABLE 错误,当我kind尝试etag搜索来自多个7天。奇怪的是,当我搜索自己的邮件(G Suite 所有者)的信息时,它会返回我期望的正确数据,我已经尝试搜索几封不是所有者的邮件并且我知道它们存在。我在 Python 中使用委托帐户。

4

0 回答 0