Forums

Attempt 1 at connecting failed: ConnectionRefusedError: [Errno 111] Connect call failed ('149.154.167.51', 443)

I'm trying to run a simple telethon bot for telegram. Locally on my computer everything starts without problems. The subscription is active. What could be the problem? On the Internet, I found some articles that say that the problem is in the free account. But I have a paid account

It could be a proxy issue -- see: https://help.pythonanywhere.com/pages/403ForbiddenError/#proxy-details

I tried to connect through a proxy, I get the following errors

File "/home/danilishna/my_bot_doloto1/app.py", line 5, in <module>
    from utils import countChecker
  File "/home/danilishna/my_bot_doloto1/utils/countChecker.py", line 27, in <module>
    client.start()
  File "/home/danilishna/.local/lib/python3.9/site-packages/telethon/client/auth.py", line 133, in start
    else self.loop.run_until_complete(coro)
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/home/danilishna/.local/lib/python3.9/site-packages/telethon/client/auth.py", line 140, in _start
    await self.connect()
  File "/home/danilishna/.local/lib/python3.9/site-packages/telethon/client/telegrambaseclient.py", line 525, in connect
    if not await self._sender.connect(self._connection(
  File "/home/danilishna/.local/lib/python3.9/site-packages/telethon/network/mtprotosender.py", line 127, in connect
    await self._connect()
  File "/home/danilishna/.local/lib/python3.9/site-packages/telethon/network/mtprotosender.py", line 227, in _connect
    connected = await self._try_connect(attempt)
  File "/home/danilishna/.local/lib/python3.9/site-packages/telethon/network/mtprotosender.py", line 277, in _try_connect
    await self._connection.connect(timeout=self._connect_timeout)
  File "/home/danilishna/.local/lib/python3.9/site-packages/telethon/network/connection/connection.py", line 244, in connect
    await self._connect(timeout=timeout, ssl=ssl)
  File "/home/danilishna/.local/lib/python3.9/site-packages/telethon/network/connection/connection.py", line 225, in _connect
    sock = await self._proxy_connect(
  File "/home/danilishna/.local/lib/python3.9/site-packages/telethon/network/connection/connection.py", line 135, in _proxy_connect
    sock = await proxy.connect(
  File "/home/danilishna/.local/lib/python3.9/site-packages/python_socks/async_/asyncio/_proxy.py", line 64, in connect
    raise ProxyTimeoutError('Proxy connection timed out: {}'.format(self._timeout)) from e
python_socks._errors.ProxyTimeoutError: Proxy connection timed out: 10

You do not need to connect through the proxy from a paid account and that will not work for mtproto connections, anyway. Is there any more to the error when you connect directly?

when connecting directly, I get this error Attempt 1 at connecting failed: ConnectionRefusedError: [Errno 111] Connect call failed ('149.154.167.51', 443)

Where are you running this code? I see you upgraded only recently -- if you're running it in a console that was created before the upgrade it will still have the internet restrictions.

Yes, that's right, the console was created before the transition to paid mode. Do I need to create a new one?

Yes, you do.