mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 20:59:29 +00:00
36 lines
824 B
ReStructuredText
36 lines
824 B
ReStructuredText
Proxy Settings
|
|
==============
|
|
|
|
Pyrogram supports proxies with and without authentication. This feature allows Pyrogram to exchange data with Telegram
|
|
through an intermediate SOCKS 4/5 or HTTP (CONNECT) proxy server.
|
|
|
|
.. contents:: Contents
|
|
:backlinks: none
|
|
:depth: 1
|
|
:local:
|
|
|
|
-----
|
|
|
|
Usage
|
|
-----
|
|
|
|
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``.
|
|
|
|
.. code-block:: python
|
|
|
|
from pyrogram import Client
|
|
|
|
app = Client(
|
|
"my_account",
|
|
proxy=dict(
|
|
scheme="socks5", # "socks4", "socks5" and "http" are supported
|
|
hostname="11.22.33.44",
|
|
port=1234,
|
|
username="<your_username>",
|
|
password="<your_password>"
|
|
)
|
|
)
|
|
|
|
app.run()
|