mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 09:26:37 +03:00
Use getpass instead input for the password
parent
d5451dfa15
commit
8ee21b606a
|
@ -1,13 +1,14 @@
|
|||
If you have Two Factor Authorization (from now on, 2FA) enabled on your account, calling `.sign_in` will raise a `SessionPasswordNeededError`. When this happens, just `.sign_in()` again with a `password=`:
|
||||
|
||||
```python
|
||||
import getpass
|
||||
from telethon.errors import SessionPasswordNeededError
|
||||
|
||||
client.sign_in(phone)
|
||||
try:
|
||||
client.sign_in(code=input('Enter code: '))
|
||||
except SessionPasswordNeededError:
|
||||
client.sign_in(password=input('Enter password: '))
|
||||
client.sign_in(password=getpass.getpass())
|
||||
```
|
||||
|
||||
## Enabling 2FA
|
||||
|
|
Loading…
Reference in New Issue
Block a user