Skip to content

Commit

Permalink
Merge pull request #869 from amakarudze/fix-868
Browse files Browse the repository at this point in the history
Catch HttpError when creating/migrating emails
  • Loading branch information
amakarudze authored Mar 8, 2023
2 parents 9b8f559 + 40f0b36 commit 71a7af9
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions core/gmail_accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,21 @@ def create_gmail_account(event):
if not service:
return None, None

service.users().insert(
body={
"primaryEmail": email,
"name": {
"fullName": event.name,
"givenName": "Django Girls",
"familyName": event.city,
},
"password": password,
"changePasswordAtNextLogin": True,
}
).execute()
try:
service.users().insert(
body={
"primaryEmail": email,
"name": {
"fullName": event.name,
"givenName": "Django Girls",
"familyName": event.city,
},
"password": password,
"changePasswordAtNextLogin": True,
}
).execute()
except HttpError:
return None, None

return email, password

Expand Down

0 comments on commit 71a7af9

Please sign in to comment.