import sys
import socks
from telethon import TelegramClient
from telethon.tl.types import InputPhoneContact
from telethon.tl.functions.contacts import ImportContactsRequest
from telethon.errors import FloodWaitError, RPCError
api_id = 0 # a valid api_id
api_hash = '' # a valid api_hash
w = input('Which: ')
host = 8.8.8.8 # a valid host
port = 80 # a valid port
proxy = (socks.SOCKS5, host, port)
client = TelegramClient('N{}'.format(w), api_id, api_hash, proxy)
client.connect()
Above code doesn't work. what is the problem???
what is the problem???
No idea. Why doesn't it work? What's the problem? Have you tried connecting without a socket? Does that work? Can you confirm that said "valid host and port" work correctly somehow else?
valid host and port works with requests and opens a URL successfully. and doesn't work
without proxy, it's OK
Could you at least provide a traceback of where it stops working, or what the error is?
socks.GeneralProxyError: Socket error: timed out
This is the error what happens
It happens in 'client.connect()' line
It Worked successfully!!! Thanks
What worked?
with another proxy:))
Okay, we can close the issue then.
i got timeout too. [Errno Connection to Telegram failed %d time(s)]
with another proxy:))
which proxy?
Most helpful comment
What worked?