Код: Выделить всё
from telethon import TelegramClient
import logging
api_id = 1111111
api_hash = 'd0111111111111111111111111111111'
client = TelegramClient('session_name', api_id, api_hash)
logging.basicConfig(level=logging.DEBUG)
client.start()
Смотрите журнал ниже.
Код: Выделить всё
INFO:telethon.network.mtprotosender:Connecting to 149.154.167.51:443/TcpFull...
DEBUG:telethon.network.mtprotosender:Connection attempt 1...
DEBUG:telethon.network.mtprotosender:Connection success!
DEBUG:telethon.network.mtprotosender:New auth_key attempt 1...
INFO:telethon.network.connection.connection:The server closed the connection
WARNING:telethon.network.mtprotosender:Connection error 1 during auth_key gen: ConnectionError: Not connected
DEBUG:telethon.network.mtprotosender:Connection attempt 2...
DEBUG:telethon.network.mtprotosender:Connection success!
DEBUG:telethon.network.mtprotosender:New auth_key attempt 2...
INFO:telethon.network.connection.connection:The server closed the connection
WARNING:telethon.network.mtprotosender:Connection error 2 during auth_key gen: ConnectionError: Not connected
DEBUG:telethon.network.mtprotosender:Connection attempt 3...
DEBUG:telethon.network.mtprotosender:Connection success!
DEBUG:telethon.network.mtprotosender:New auth_key attempt 3...
INFO:telethon.network.connection.connection:The server closed the connection
WARNING:telethon.network.mtprotosender:Connection error 3 during auth_key gen: ConnectionError: Not connected
DEBUG:telethon.network.mtprotosender:Connection attempt 4...
DEBUG:telethon.network.mtprotosender:Connection success!
DEBUG:telethon.network.mtprotosender:New auth_key attempt 4...
INFO:telethon.network.connection.connection:The server closed the connection
WARNING:telethon.network.mtprotosender:Connection error 4 during auth_key gen: ConnectionError: Not connected
DEBUG:telethon.network.mtprotosender:Connection attempt 5...
DEBUG:telethon.network.mtprotosender:Connection success!
DEBUG:telethon.network.mtprotosender:New auth_key attempt 5...
INFO:telethon.network.connection.connection:The server closed the connection
WARNING:telethon.network.mtprotosender:Connection error 5 during auth_key gen: ConnectionError: Not connected
DEBUG:telethon.network.mtprotosender:Connection attempt 6...
DEBUG:telethon.network.mtprotosender:Connection success!
DEBUG:telethon.network.mtprotosender:New auth_key attempt 6...
INFO:telethon.network.connection.connection:The server closed the connection
WARNING:telethon.network.mtprotosender:Connection error 6 during auth_key gen: ConnectionError: Not connected
Traceback (most recent call last):
File "c:\Users\username\Documents\Python\telegram_read_messages.py", line 11, in
client.start()
File "C:\Users\username\AppData\Local\Programs\Python\Python39\lib\site-packages\telethon\client\auth.py", line 133, in start
else self.loop.run_until_complete(coro)
File "C:\Users\username\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 642, in run_until_complete
return future.result()
File "C:\Users\username\AppData\Local\Programs\Python\Python39\lib\site-packages\telethon\client\auth.py", line 140, in _start
await self.connect()
File "C:\Users\username\AppData\Local\Programs\Python\Python39\lib\site-packages\telethon\client\telegrambaseclient.py", line 513, in connect
if not await self._sender.connect(self._connection(
File "C:\Users\username\AppData\Local\Programs\Python\Python39\lib\site-packages\telethon\network\mtprotosender.py", line 127, in connect
await self._connect()
File "C:\Users\username\AppData\Local\Programs\Python\Python39\lib\site-packages\telethon\network\mtprotosender.py", line 253, in _connect
raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 5 time(s)
Любые советы приветствуются.
Подробнее здесь: https://stackoverflow.com/questions/682 ... tion-error
Мобильная версия