Search code examples
telethon

Is telethon blocked in the US?


I run the simple example from the official guide on a US server and got the error: "ConnectionError: Connection to Telegram failed 5 time(s)". I tried a US laptop, the same error.

I then tried an HK server, which worked. Is TG API blocked in the, US?

The example I'm using:

from telethon import TelegramClient

# Use your own values from my.telegram.org
api_id = 12345
api_hash = '0123456789abcdef0123456789abcdef'

# The first parameter is the .session file name (absolute paths allowed)
with TelegramClient('anon', api_id, api_hash) as client:
    client.loop.run_until_complete(client.send_message('me', 'Hello, myself!'))

Solution

  • OK, api.telegram.org is blocked in the US, at least on the networks I'm using. I worked it out by routing through a Poland Tor node.

    PS. Telegram works fine in the US. Telegram != Telethon