-
-
Notifications
You must be signed in to change notification settings - Fork 78
Network Configuration and Proxy
Written for EFB Telegram Master 2.0.0b18
This chapter is adapted from Python Telegram Bot wiki, licensed under CC-BY 3.0.
ptb performs HTTPS requests using urllib3. urllib3 provides control over connect_timeout & read_timeout. urllib3 does not separate between what would be considered read & write timeout, so read_timeout serves for both. The defaults chosen for each of these parameters is 5 seconds.
The connect_timeout value controls the timeout for establishing a connection to the Telegram server(s).
Changing the defaults of read_timeout & connet_timeout can be done by adjusting values request_kwargs section in ETM's config.yaml.
# ...
request_kwargs:
read_timeout: 6
connect_timeout: 7This chapter is adapted from Python Telegram Bot wiki, licensed under CC-BY 3.0.
You can appoint proxy specifically for ETM without affecting other channels running in together in the same EFB instance.
This can also be done by adjusting values request_kwargs section in ETM's config.yaml.
request_kwargs:
# ...
proxy_url: http://PROXY_HOST:PROXY_PORT/
# Optional, if you need authentication:
username: PROXY_USER
password: PROXY_PASS This is configuration is supported, but requires an optional/extra python package. To install:
pip install python-telegram-bot[socks]request_kwargs:
# ...
proxy_url: socks5://URL_OF_THE_PROXY_SERVER:PROXY_PORT
# Optional, if you need authentication:
urllib3_proxy_kwargs:
username: PROXY_USER
password: PROXY_PASS