0

次のように、新しいグループを作成して設定をアップロードする同期スクリプトがあります。

        for group in self.groups:
            try:
                print("%s@%s" % (group, self.admin_directory.__domain__))
                self.admin_directory.insert_group(email="%s@%s" % (group, self.admin_directory.__domain__),
                                                  name=group,
                                                  description=group)
                time.sleep(1)
            except HttpError as e:
                if(e.resp.status == 409):
                    print("%s was already a group in Google." % group)
                else:
                    print(e)

            try:
                print(json.dumps(self.groups[group]['settings'], indent=4))
                self.groups_settings.update("%s@%s" % (group, self.admin_directory.__domain__),
                                            self.groups[group]['settings'])
                time.sleep(1)
            except HttpError as e:
                print(e)

admin_directoryのクラスとgroups_settingsクラスはgoogle.oauth2ライブラリを使用します

私がロードしたjsonは次のようになります:

{
  "kind": "groupsSettings#groups",
  "email": "<email>",
  "name": "<group_name>",
  "description": "<group_name>",
  "whoCanJoin": "INVITED_CAN_JOIN",
  "whoCanViewMembership": "ALL_MEMBERS_CAN_VIEW",
  "whoCanViewGroup": "ALL_MEMBERS_CAN_VIEW",
  "whoCanInvite": "NONE_CAN_INVITE",
  "whoCanAdd": "ALL_MANAGERS_CAN_ADD",
  "allowExternalMembers": "true",
  "whoCanPostMessage": "ALL_IN_DOMAIN_CAN_POST",
  "allowWebPosting": "false",
  "primaryLanguage": "en",
  "maxMessageBytes": 10485760,
  "isArchived": "true",
  "archiveOnly": "false",
  "messageModerationLevel": "MODERATE_ALL_MESSAGES",
  "spamModerationLevel": "REJECT",
  "replyTo": "REPLY_TO_SENDER",
  "customReplyTo": "",
  "includeCustomFooter": "false",
  "customFooterText": "",
  "sendMessageDenyNotification": "false",
  "defaultMessageDenyNotificationText": "",
  "showInGroupDirectory": "false",
  "allowGoogleCommunication": "false",
  "membersCanPostAsTheGroup": "false",
  "messageDisplayFont": "DEFAULT_FONT",
  "includeInGlobalAddressList": "true",
  "whoCanLeaveGroup": "ALL_MEMBERS_CAN_LEAVE",
  "whoCanContactOwner": "ALL_IN_DOMAIN_CAN_CONTACT",
  "whoCanAddReferences": "NONE",
  "whoCanAssignTopics": "NONE",
  "whoCanUnassignTopic": "NONE",
  "whoCanTakeTopics": "NONE",
  "whoCanMarkDuplicate": "NONE",
  "whoCanMarkNoResponseNeeded": "NONE",
  "whoCanMarkFavoriteReplyOnAnyTopic": "NONE",
  "whoCanMarkFavoriteReplyOnOwnTopic": "NONE",
  "whoCanUnmarkFavoriteReplyOnAnyTopic": "NONE",
  "whoCanEnterFreeFormTags": "NONE",
  "whoCanModifyTagsAndCategories": "NONE",
  "favoriteRepliesOnTop": "false"
}

ここでAPIエクスプローラーで正確なJSONを使用すると機能しますが、このスクリプトを介してアップロードすると、 <HttpError 400 when requesting https://www.googleapis.com/groups/v1/groups/<group_name>%40<domain>?alt=json returned "Invalid Value">

なぜこれを行っているのか理解できないようです。

他の誰かがこの問題を経験しましたか?もしそうなら、エラーを理解できましたか?

4

0 に答える 0