diff --git a/personalcapital/personalcapital.py b/personalcapital/personalcapital.py index 52f66df..3388994 100644 --- a/personalcapital/personalcapital.py +++ b/personalcapital/personalcapital.py @@ -27,6 +27,7 @@ def getErrorValue(result): class AuthLevelEnum(object): USER_REMEMBERED = "USER_REMEMBERED" + MFA_REQUIRED = "MFA_REQUIRED" class TwoFactorVerificationModeEnum(object): SMS = 0 @@ -60,6 +61,8 @@ def login(self, username, password): result = self.__authenticate_password(password).json() if getSpHeaderValue(result, SUCCESS_KEY) == False: raise LoginFailedException(getErrorValue(result)) + elif getSpHeaderValue(result, AUTH_LEVEL_KEY) == AuthLevelEnum.MFA_REQUIRED: + raise RequireTwoFactorException() else: raise LoginFailedException() @@ -207,4 +210,4 @@ def __authenticate_password(self, passwd): "csrf": self.__csrf } return self.post("/credential/authenticatePassword", data) - \ No newline at end of file +