userUsageReport不返回用户信息

问题描述

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

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和{{1的字典}}键),当我尝试搜索超过7天的数据时。奇怪的是,当我搜索自己的邮件(G Suite所有者)的信息时,它将返回我期望的正确数据,我已经尝试搜索不是所有者的几封邮件,而且我知道它们存在。我正在使用Python中的委托帐户。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)