Use getpass instead input for the password

Lonami 2017-09-25 12:45:53 +02:00
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