twikit icon indicating copy to clipboard operation
twikit copied to clipboard

Change input() calls to async input for compatibility in asynchronous workflows

Open kevinkaburu opened this issue 1 year ago • 2 comments

There are two instances where input() is used for user interaction (specifically in the LoginTwoFactorAuthChallenge and LoginAcid subtasks). These calls are synchronous, which causes issues when trying to use the library in an asynchronous environment.

Since the library is largely asynchronous, blocking input operations (like input()) break the flow when using it in modern async workflows. It would be beneficial to update these input() calls to non-blocking async input() calls or use another async-friendly input handling mechanism.

Affected Areas:

  • LoginTwoFactorAuthChallenge subtask: Uses input() to request a TOTP or 2FA code from the user.
  • LoginAcid subtask: Uses input() to request further authentication (e.g., via email or phone).

Suggested Solution:

  • Replace the synchronous input() calls with an asynchronous input mechanism.
  • Use asyncio or an async-compatible function to collect user input without blocking the event loop.

kevinkaburu avatar Sep 19 '24 11:09 kevinkaburu

pls fix this

ugsystem avatar Oct 15 '24 04:10 ugsystem

It would be cool to add the ability to set a callback function so that this process could be automated

mkuchuman avatar Apr 07 '25 17:04 mkuchuman