v20.7 proxy api name update

vior 2023-12-01 12:29:13 +08:00
parent eb95b874f4
commit e37ccb766a

@ -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.