mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-10-23 17:36:26 +02:00
v20.7 proxy api name update
parent
eb95b874f4
commit
e37ccb766a
1 changed files with 2 additions and 2 deletions
|
@ -19,7 +19,7 @@ from telegram.ext import ApplicationBuilder
|
|||
|
||||
# "USERNAME:PASSWORD@" is optional, if you need authentication:
|
||||
proxy_url = 'http://USERNAME:PASSWORD@PROXY_HOST:PROXY_PORT' # can also be a https proxy
|
||||
app = ApplicationBuilder().token("TOKEN").proxy_url(proxy_url).get_updates_proxy_url(proxy_url).build()
|
||||
app = ApplicationBuilder().token("TOKEN").proxy(proxy_url).get_updates_proxy(proxy_url).build()
|
||||
```
|
||||
|
||||
In the last line, we setup the proxy such that it'll be used both for making requests to the Bot API like `Bot.send_message` ([`proxy_url()`](https://python-telegram-bot.readthedocs.io/telegram.ext.applicationbuilder.html#telegram.ext.ApplicationBuilder.proxy_url)) and for fetching updates from Telegram ([`get_updates_proxy_url`](https://python-telegram-bot.readthedocs.io/telegram.ext.applicationbuilder.html#telegram.ext.ApplicationBuilder.get_updates_proxy_url)). It is not necessary to setup a proxy for both, you can do it for either of them.
|
||||
|
@ -35,7 +35,7 @@ from telegram.ext import ApplicationBuilder
|
|||
|
||||
proxy_url = "socks5://user:pass@host:port"
|
||||
|
||||
app = ApplicationBuilder().token("TOKEN").proxy_url(proxy_url).build()
|
||||
app = ApplicationBuilder().token("TOKEN").proxy(proxy_url).build()
|
||||
```
|
||||
|
||||
If you're more of an advanced user and would like to customize your proxy setup even further, check out the [docs of httpx](https://www.python-httpx.org/advanced/#http-proxying) for more info.
|
Loading…
Reference in a new issue