pyrogram/docs/source/topics/proxy.rst

35 lines
804 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
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
app.run()