Skip to content

Comments

Handle missing MFA method in login process#73

Merged
MaxxRK merged 3 commits intoMaxxRK:mainfrom
Amodio:Amodio-mfa-error
Feb 3, 2026
Merged

Handle missing MFA method in login process#73
MaxxRK merged 3 commits intoMaxxRK:mainfrom
Amodio:Amodio-mfa-error

Conversation

@Amodio
Copy link
Contributor

@Amodio Amodio commented Feb 3, 2026

Fix #72

Raise error if no valid MFA method is provided during login:

$ ./test.py 
Traceback (most recent call last):
  File "/home/da/./test.py", line 8, in <module>
    need_code = ft_ss.login()
                ^^^^^^^^^^^^^
  File "/home/da/.local/lib/python3.12/site-packages/firstrade/account.py", line 134, in login
    need_code = self._handle_mfa()
                ^^^^^^^^^^^^^^^^^^
  File "/home/da/.local/lib/python3.12/site-packages/firstrade/account.py", line 266, in _handle_mfa
    raise LoginError(
firstrade.exceptions.LoginError: MFA required but no valid MFA method was provided (pin, email/phone, or mfa_secret).

Raise error if no valid MFA method is provided during login.
$ flake8 --select=E128 /home/da/.local/lib/python3.12/site-packages/firstrade/account.py
@MaxxRK MaxxRK merged commit e40a16d into MaxxRK:main Feb 3, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash if no MFA method was provided

2 participants