Answer the question
In order to leave comments, you need to log in
telethon not working on pythonanywhere?
I want to make a request via telethon to a pythonanywhere host.
Gives me an error:
Traceback (most recent call last):
File "/home/me/text.py", line 13, in
client.start()
File "/home/me/.local/lib/python3.7/site-packages/telethon /client/auth.py", line 132, in start
else self.loop.run_until_complete(coro)
Traceback (most recent call last):
File "/home/me/text.py", line 15, in
client.start( )
File "/home/me/.local/lib/python3.7/site-packages/telethon/client/auth.py", line 132, in start
else self.loop.run_until_complete(coro)
File "/usr/lib /python3.7/asyncio/base_events.py", line 579, in run_until_complete
return future.result()
File "/home/me/.local/lib/python3.7/site-packages/telethon/client/auth.py ",line 139, in_start
await self.connect()
File "/home/me/.local/lib/python3.7/site-packages/telethon/client/telegrambaseclient.py", line 445, in connect
proxy=self._proxy
File "/home/ me/.local/lib/python3.7/site-packages/telethon/network/mtprotosender.py", line 125, in connect
await self._connect()
File "/home/me/.local/lib/python3.7 /site-packages/telethon/network/mtprotosender.py", line 250, in _connect
raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 5 time (s)
from telethon import TelegramClient, sync, functions
from telethon.tl.functions.messages import ImportChatInviteRequest
from telethon import connection
api_id = '**'
api_hash = '**'
client = TelegramClient('test', api_id, api_hash)
client.start()
username = client.get_entity('user')
print(username)
Answer the question
In order to leave comments, you need to log in
The problem was in the host. Read more: help.pythonanywhere.com/pages/403ForbiddenError
I bought a subscription and everything started working.
Write in BASH [Console] command: pip3.8 install --user telethon
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question