mirror of
https://github.com/SlavikMIPT/tgcloud.git
synced 2025-03-09 15:40:14 +00:00
Merge 6138a24a85
into c59a982d03
This commit is contained in:
commit
0fa8b90b76
1 changed files with 7 additions and 2 deletions
|
@ -11,7 +11,7 @@ import mimetypes
|
|||
from telethon.tl.types import DocumentAttributeFilename
|
||||
from telethon.tl.types import Document
|
||||
from telethon.utils import get_input_media
|
||||
from telethon.errors.rpc_error_list import LocationInvalidError
|
||||
from telethon.errors.rpc_error_list import LocationInvalidError, SessionPasswordNeededError
|
||||
# from telegram_client_x import TelegramClientX
|
||||
from telethon.telegram_client import TelegramClient
|
||||
from telethon.tl.types import Message
|
||||
|
@ -68,7 +68,12 @@ client.connect()
|
|||
if not client.is_user_authorized():
|
||||
phone = input('Enter phone: ')
|
||||
client.send_code_request(phone)
|
||||
client.sign_in(phone, input('Enter code: '))
|
||||
try:
|
||||
client.sign_in(phone, input('Enter code: '))
|
||||
except SessionPasswordNeededError:
|
||||
client.sign_in(password=input('Enter password:'))
|
||||
|
||||
|
||||
def on_download_progress(recv_bytes, total_bytes):
|
||||
global last_call_time_receive
|
||||
if time.time() - last_call_time_receive < 1:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue