Telethon: python 3.8 proxy bug

Hi everyone.

Running python64 3.8 under Windows 10

proxy = (socks.SOCKS5, '1.1.1.1', 1111)
client = TelegramClient(sessions_folder + phone, api_id, api_hash, proxy=proxy)
client.connect()

I am able to connect despite using not valid proxy, hence the proxy is not used. Under python 3.7 i get expected “can’t connect” response.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 19 (12 by maintainers)

Commits related to this issue

Most upvoted comments

I did some research. ProactorEventLoop causing the proxy to be ignored. In python 3.8 changelog:

on Windows, the default asyncio event loop is now ProactorEventLoop

Setting event loop to SelectorEventLoop fixes the issue.

asyncio.set_event_loop(asyncio.SelectorEventLoop())

I’m having similar issue: client ignores proxy settings, it’s trying to connect to servers directly.

3.8 32bit