Skip to content

Commit 3b01344

Browse files
authored
Merge pull request #201 from natekspencer/dev
Add additional logging
2 parents 6c96e5b + 5c7dfd0 commit 3b01344

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

vivintpy/const.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ class AuthenticationResponse:
55
"""Authentication response constants."""
66

77
ERROR = "error"
8+
ERROR_DESCRIPTION = "error_description"
89
INVALID = "Invalid username and/or password"
910
MESSAGE = "msg"
1011
MFA_REQUIRED = "Multi-factor authentication required"

vivintpy/vivintskyapi.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,11 +530,13 @@ async def __get_vivintsky_session(self, username: str, password: str) -> None:
530530
# Check for TOTP/MFA requirement
531531
if "validate" in resp:
532532
# SMS/emailed code
533+
_LOGGER.debug("MFA response: %s", resp)
533534
self.__mfa_pending = True
534535
self.__mfa_type = "code"
535536
raise VivintSkyApiMfaRequiredError(AuthenticationResponse.MFA_REQUIRED)
536537
if "mfa" in resp:
537538
# Authenticator app code
539+
_LOGGER.debug("MFA response: %s", resp)
538540
self.__mfa_pending = True
539541
self.__mfa_type = "mfa"
540542
raise VivintSkyApiMfaRequiredError(AuthenticationResponse.MFA_REQUIRED)
@@ -641,6 +643,8 @@ async def __call(
641643
)
642644
if not message:
643645
message = resp_data.get(AuthenticationResponse.ERROR)
646+
if AuthenticationResponse.ERROR_DESCRIPTION in resp_data:
647+
message = f"{message}: {resp_data[AuthenticationResponse.ERROR_DESCRIPTION]}"
644648
if message == AuthenticationResponse.MFA_REQUIRED or is_mfa_request:
645649
self.__mfa_pending = True
646650
raise VivintSkyApiMfaRequiredError(message)

0 commit comments

Comments
 (0)