From 4fc678ec28c87f0938723c62d61aa37fe163e204 Mon Sep 17 00:00:00 2001 From: cwilko Date: Tue, 28 Mar 2023 21:00:42 +0100 Subject: [PATCH 1/2] Handle error case for no MFA methods (#203) Handle error case for no MFA methods --- arlo.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/arlo.py b/arlo.py index 34ee1ff..b743c5e 100644 --- a/arlo.py +++ b/arlo.py @@ -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( From 46d1e945b9eee6a253bbeb8e84636828d18dadcf Mon Sep 17 00:00:00 2001 From: Jeffrey Walter Date: Wed, 5 Apr 2023 10:16:31 -0500 Subject: [PATCH 2/2] Make new release --- docs/README.md | 4 ++-- docs/arlo.html | 4 ++-- setup.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/README.md b/docs/README.md index c6ebeaa..f5dbf47 100644 --- a/docs/README.md +++ b/docs/README.md @@ -686,7 +686,7 @@ mode: rainbow or rgb. ` def SetNightLightTimerOff(self, basestation, time=0, timediff=300) ` -` def SetNightLightTimerOn(self, basestation, time=1668719909, timediff=0) ` +` def SetNightLightTimerOn(self, basestation, time=1680708090, timediff=0) ` ` def SetOCProfile(self, firstName, lastName, country='United States', language='en', spam_me=0) ` @@ -717,7 +717,7 @@ watch the schema that gets sent. ` def SetSleepTimerOff(self, basestation, time=0, timediff=300) ` -` def SetSleepTimerOn(self, basestation, time=1668719909, timediff=0) ` +` def SetSleepTimerOn(self, basestation, time=1680708090, timediff=0) ` ` def SetTempAlertOff(self, basestation) ` diff --git a/docs/arlo.html b/docs/arlo.html index 0808f80..6b1f346 100644 --- a/docs/arlo.html +++ b/docs/arlo.html @@ -1235,7 +1235,7 @@
-def SetNightLightTimerOn(self, basestation, time=1668719909, timediff=0) +def SetNightLightTimerOn(self, basestation, time=1680708090, timediff=0)
@@ -1362,7 +1362,7 @@
-def SetSleepTimerOn(self, basestation, time=1668719909, timediff=0) +def SetSleepTimerOn(self, basestation, time=1680708090, timediff=0)
diff --git a/setup.py b/setup.py index aa309a3..d2d0007 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ def readme(): setup( name='arlo', py_modules=['arlo', 'request', 'eventstream'], - version='1.2.62', + version='1.2.64', description='Python Arlo is a library written in Python 2.7/3x ' + 'which exposes the Netgear Arlo cameras via the apis that are consumed by their website.', long_description=readme(),