2022-04-24 09:56:07 +00:00
|
|
|
Proxy Settings
|
|
|
|
==============
|
2018-01-18 12:23:05 +00:00
|
|
|
|
2018-02-08 16:04:10 +00:00
|
|
|
Pyrogram supports proxies with and without authentication. This feature allows Pyrogram to exchange data with Telegram
|
2022-04-24 09:56:07 +00:00
|
|
|
through an intermediate SOCKS 4/5 or HTTP (CONNECT) proxy server.
|
2018-01-18 12:23:05 +00:00
|
|
|
|
2020-04-01 18:08:46 +00:00
|
|
|
.. contents:: Contents
|
|
|
|
:backlinks: none
|
2020-08-22 06:05:05 +00:00
|
|
|
:depth: 1
|
2020-04-01 18:08:46 +00:00
|
|
|
:local:
|
|
|
|
|
|
|
|
-----
|
|
|
|
|
2018-01-18 12:23:05 +00:00
|
|
|
Usage
|
|
|
|
-----
|
|
|
|
|
2022-04-24 09:56:07 +00:00
|
|
|
To use Pyrogram with a proxy, use the *proxy* parameter in the Client class. If your proxy doesn't require authorization
|
|
|
|
you can omit ``username`` and ``password``.
|
2018-01-18 12:23:05 +00:00
|
|
|
|
2022-04-24 09:56:07 +00:00
|
|
|
.. code-block:: python
|
2018-01-18 12:23:05 +00:00
|
|
|
|
2022-04-24 09:56:07 +00:00
|
|
|
from pyrogram import Client
|
|
|
|
|
|
|
|
proxy = {
|
|
|
|
"scheme": "socks5", # "socks4", "socks5" and "http" are supported
|
|
|
|
"hostname": "11.22.33.44",
|
|
|
|
"port": 1234,
|
|
|
|
"username": "username",
|
|
|
|
"password": "password"
|
|
|
|
}
|
|
|
|
|
|
|
|
app = Client("my_account", proxy=proxy)
|
2018-02-22 10:02:38 +00:00
|
|
|
|
2022-04-24 09:56:07 +00:00
|
|
|
app.run()
|