diff --git a/src/google_admin_sdk_utils.py b/src/google_admin_sdk_utils.py index 2b0bc27..5433bb2 100644 --- a/src/google_admin_sdk_utils.py +++ b/src/google_admin_sdk_utils.py @@ -36,9 +36,9 @@ def __init__(self, logger=logging.getLogger(__name__)): def get_group(self, group_key: str): return self.service.groups().get(groupKey=group_key).execute() - def insert_member(self, group_key: str, email: str): + def insert_member(self, group_key: str, email: str, num_retries: int = 2): try: - self.service.members().insert(groupKey=group_key, body={"email": email}).execute() + self.service.members().insert(groupKey=group_key, body={"email": email}).execute(num_retries=num_retries) except HttpError as e: if e.resp.status == 409: self.logger.warning(f"Member {email} already exists in group {group_key}. Ignoring.")