我正在尝试使用发现 API 获取 Google 网上论坛的所有成员。 所以我使用了 doc 中给出的代码但我收到以下错误:
'Error(2033): Group resource name has the correct format of `groups/{group_id}`, but it contains an invalid `{groupd_id}`
我使用 Google 网上论坛的电子邮件地址或纯文本名称作为 group_id
,但错误仍然存在。
该组 ID 的正确语法是什么?
代码:
group_id = 'my_google_group@my_organization.com'
request = service.groups().memberships().searchTransitiveMemberships(parent=f'groups/{group_id}')
最佳答案
您可以获取 group_id
您知道使用 gcloud 控制台的群组的电子邮件地址:
$ gcloud identity groups describe <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="136a7c66613e74617c66633e7d727e7653777c7e727a7d3d707c7e" rel="noreferrer noopener nofollow">[email protected]</a>
这将返回类似的内容:
createTime: '2019-01-01T00:00:00.000000Z'
displayName: YourGroupName
groupKey:
id: <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="dfa6b0aaadf2b8adb0aaaff2b1beb2ba9fbbb0b2beb6b1f1bcb0b2" rel="noreferrer noopener nofollow">[email protected]</a>
labels:
cloudidentity.googleapis.com/groups.discussion_forum: ''
name: groups/8673hkdnjaod98f
parent: customers/Cjas8duwn
updateTime: '2021-01-01T00:00:00.000000Z'
与您相关的部分是:
name: groups/8673hkdnjaod98f
所以在这个例子中 group_id
是:8673hkdnjaod98f
关于python - 获取 Google 群组成员,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70113262/