Advertisement
Guest User

Untitled

a guest
Aug 26th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. # Create the client and connect
  2. client = TelegramClient(username, api_id, api_hash)
  3. client.start()
  4. print("Client Created")
  5. # Ensure you're authorized
  6. if not client.is_user_authorized():
  7. client.send_code_request(phone)
  8. try:
  9. client.sign_in(phone, input('Enter the code: '))
  10. except SessionPasswordNeededError:
  11. client.sign_in(password=input('Password: '))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement