From 8ee21b606aa26ca4ed345b75ae068c19920183ff Mon Sep 17 00:00:00 2001 From: Lonami Date: Mon, 25 Sep 2017 12:45:53 +0200 Subject: [PATCH] Use getpass instead input for the password --- Two-Factor-Authorization.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Two-Factor-Authorization.md b/Two-Factor-Authorization.md index 88175ad..0628a0b 100644 --- a/Two-Factor-Authorization.md +++ b/Two-Factor-Authorization.md @@ -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