Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/jeffreydwalter/arlo
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreydwalter committed Apr 5, 2023
2 parents 70f66a0 + 4fc678e commit a4f08c8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions arlo.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,14 @@ def LoginMFA(self, username, password, google_credential_file):
headers=headers,
raw=True
)
email_factor_id = next(i for i in factors_body['data']['items'] if i['factorType'] == 'EMAIL' and i['factorRole'] == "PRIMARY")['factorId']
if email_factor_id is None:
email_factor_id = next(i for i in factors_body['data']['items'] if i['factorType'] == 'EMAIL' and i['factorRole'] == "SECONDARY")['factorId']
email_factor = next((i for i in factors_body['data']['items'] if i['factorType'] == 'EMAIL' and i['factorRole'] == "PRIMARY"), None)
if email_factor is None:
email_factor = next((i for i in factors_body['data']['items'] if i['factorType'] == 'EMAIL' and i['factorRole'] == "SECONDARY"), None)

if email_factor is None:
raise Exception('No EMAIL MFA method registered with the account.')

email_factor_id = email_factor['factorId']

# Start factor auth
start_auth_body = self.request.post(
Expand Down

0 comments on commit a4f08c8

Please sign in to comment.