Closed valeriiisotnyk closed 7 months ago
Indeed, as you say, the authentication code should be able to be passed as an argument as well as an input. Currently that is not possible, but will be added in the future.
@valeriiisotnyk
I have uploaded an idea for a new login method to Gist. Three new args have been added: twofa_code
, verification_code
, and throw_exception
. If throw_exception
is set to True, an exception is thrown if a two-factor authentication code or verification code is required. And the 2FA code and verification code can be given as arguments.
Please provide feedback if you have any other suggestions.
https://gist.github.com/d60/e79f556f761261d29bdc2a85032ef0de#file-1-py
@d60 I'll make the changes in my fork. Thank you
Hi, Can you modify the login process so that, in situations requiring 2FA or a verification step, it throws an exception instead of prompting for input? If such an exception occurs, could we attempt to log in again, possibly passing the 2FA code directly into the login function? Alternatively, could you create a function that sets this code and initiates the login process? The current method, which falls back to an input prompt, cannot be automated.
https://github.com/d60/twikit/blob/main/twikit/client.py#L244 https://github.com/d60/twikit/blob/main/twikit/client.py#L258