How to use proxy in telethon?
See original GitHub issueimport 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???
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:15 (4 by maintainers)
Top Results From Across the Web
Hiding behind proxy using Telethon/Socks5 - Stack Overflow
You should use a different syntax for the proxy: from telethon.sync import TelegramClient, events import socks api_id = '' api_hash ...
Read more >Signing In — Telethon 1.26.0 documentation
If you need to use a proxy to access Telegram, you will need to either: ... (of course, replacing the protocol, IP and...
Read more >Telethon - PyPI
If you want to use Telethon via proxy, you have to install PySocks (via pip or manual). Once this is done, pass the...
Read more >how to use mtproto proxy for telethon - Code Grepper
from telethon import TelegramClient, connection # we need to change the connection ^^^^^^^^^^ client = TelegramClient( 'anon', api_id, api_hash, # Use one ...
Read more >Python Tutorial: Scraping Telegram with Datacenter Proxies
... using Python and Datacenter proxies to scrape messages, group members and more. You'll also need Telegram credentials and Telethon ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
with another proxy:))
What worked?