【发布时间】:2014-07-02 21:08:47
【问题描述】:
我正在尝试使用 Google 的管理目录 API(使用 Google 的 python 库)。
我可以很好地列出目录中的用户,使用如下代码:
results = client.users().list(customer='my_customer').execute()
但是,这些结果不包括用户所属的组。相反,一旦我有了用户列表,我就必须打电话来获取组列表:
results = client.groups().list(customer='my_customer').execute()
然后遍历每个组,调用“members” api查看组中有哪些用户:
results = client.members().list(groupKey='[group key]').execute()
这意味着我必须为每个组提出新的请求。
这似乎非常低效。必须有比这更好的方法,而我只是想念它。这是什么?
【问题讨论】:
标签: python google-api google-directory-api