pyrogram/docs/source/topics/proxy.rst

36 lines
824 B
ReStructuredText
Raw Normal View History

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
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
:depth: 1
2020-04-01 18:08:46 +00:00
:local:
-----
2018-01-18 12:23:05 +00:00
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``.
2018-01-18 12:23:05 +00:00
.. code-block:: python
2018-01-18 12:23:05 +00:00
from pyrogram import Client
2018-01-18 12:23:05 +00:00
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>"
2018-02-27 17:18:25 +00:00
)
)
2018-02-22 10:02:38 +00:00
app.run()