Anorov/PySocks

socks.GeneralProxyError: Socket error: 0x05: Connection refused

danilshik opened this issue · 0 comments

I try to use a proxy for my telegram script, but throws an error
proxy = (socks.SOCKS5, '217.29.62.231', 34354, True, 'Vfdg0Y8oa1', 'sgw35g1d1')
Error
Traceback (most recent call last):
File "D:\Git\telegram\env\lib\site-packages\socks.py", line 851, in connect
negotiate(self, dest_addr, dest_port)
File "D:\Git\telegram\env\lib\site-packages\socks.py", line 497, in _negotiate_SOCKS5
self, CONNECT, dest_addr)
File "D:\Git\telegram\env\lib\site-packages\socks.py", line 578, in _SOCKS5_request
raise SOCKS5Error("{0:#04x}: {1}".format(status, error))
socks.SOCKS5Error: 0x05: Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:/Git/telegram/telegram_new.py", line 549, in
create_client("996776912989")
File "D:/Git/telegram/telegram_new.py", line 186, in create_client
clients.append(TelegramClient(number, api_id, api_hash, proxy=proxy).start())
File "D:\Git\telegram\env\lib\site-packages\telethon\client\auth.py", line 115, in start
else self.loop.run_until_complete(coro)
File "C:\Program Files\Python36\lib\asyncio\base_events.py", line 484, in run_until_complete
return future.result()
File "D:\Git\telegram\env\lib\site-packages\telethon\client\auth.py", line 122, in _start
await self.connect()
File "D:\Git\telegram\env\lib\site-packages\telethon\client\telegrambaseclient.py", line 349, in connect
proxy=self._proxy
File "D:\Git\telegram\env\lib\site-packages\telethon\network\mtprotosender.py", line 139, in connect
await self._connect()
File "D:\Git\telegram\env\lib\site-packages\telethon\network\mtprotosender.py", line 217, in _connect
await self._connection.connect(timeout=self._connect_timeout)
File "D:\Git\telegram\env\lib\site-packages\telethon\network\connection\tcpfull.py", line 18, in connect
await super().connect(timeout=timeout, ssl=ssl)
File "D:\Git\telegram\env\lib\site-packages\telethon\network\connection\connection.py", line 62, in connect
loop=self._loop
File "C:\Program Files\Python36\lib\asyncio\tasks.py", line 358, in wait_for
return fut.result()
File "C:\Program Files\Python36\lib\asyncio\selector_events.py", line 439, in sock_connect
return (yield from fut)
File "C:\Program Files\Python36\lib\asyncio\selector_events.py", line 444, in _sock_connect
sock.connect(address)
File "D:\Git\telegram\env\lib\site-packages\socks.py", line 100, in wrapper
return function(*args, **kwargs)
File "D:\Git\telegram\env\lib\site-packages\socks.py", line 855, in connect
raise GeneralProxyError("Socket error", error)
socks.GeneralProxyError: Socket error: 0x05: Connection refused