我正在努力让我的Google应用领域用户完成所有活动。但如果有人在我的Domain Restricted Community, API is not return the community name
中发帖。它不是获取实际的社区名称,而是返回"domain"
。
如果有人在私人(仅限邀请)/公共社区中发帖,则API会显示正确的名称。
这是获取用户活动的URL。
https://www.googleapis.com/plus/v1domains/activities/peopleID/people/sharedto?fields=totalItems&alt=json
域限制社区的结果:
'access': {'items': [{'type': 'domain'}], 'kind': 'plus#acl', 'description': 'Domain', 'domainRestricted': True}
所有其他社区的结果:
'access': {'kind': 'plus#acl', 'description': 'Test Community (Discussion)', 'domainRestricted': True}
API范围&代码:
credentials = SignedJwtAssertionCredentials(API_ACCESS_DATA[CURRENT_DOMAIN]["SERVICE_ACCOUNT_EMAIL"], key, scope=[
"https://www.googleapis.com/auth/plus.circles.read",
"https://www.googleapis.com/auth/plus.circles.write",
"https://www.googleapis.com/auth/plus.profiles.read",
"https://www.googleapis.com/auth/plus.stream.read",
"https://www.googleapis.com/auth/plus.stream.write",
"https://www.googleapis.com/auth/plus.me"
], sub=user_email)
http = credentials.authorize(http)
service = build("plus", "v1domains", http=http)
我正在使用此GitHub存储库:https://github.com/vircheck/socialplus-prototype
用于获取活动的文件:
https://github.com/vircheck/socialplus-prototype/blob/master/DJANGO_GAE/socialplus/api.py
对于Domain Restricted Communities,它会抛出此异常
socialplus\data\activities.py", line 122, in _get_activity_access
raise Exception("ACL cannot be parsed for activity " + a["id"])
Exception: ACL cannot be parsed for activity zsdsdf32332132dlas3df03lvd3