askanton

Авторизируем python скрипт в телеграм с двухфакторной авторизацией (2FA)

Dec 19th, 2021 (edited)
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. import getpass
  2. from telethon.errors import SessionPasswordNeededError
  3. from telethon import TelegramClient, sync, errors
  4.  
  5. api_id =    ********* #+**********
  6. api_hash = '*****************************'
  7.  
  8. #api_id =    ********* #+*********
  9. #api_hash = ''*****************************''
  10. client = TelegramClient('my_account', api_id, api_hash)
  11.  
  12. try:
  13.     client.start(password="123456789")
  14. except Exception as e:
  15.     print(e)
  16.  
  17. client.run_until_disconnected()
Add Comment
Please, Sign In to add comment