Skip to content

Commit 160163b

Browse files
authored
Remove deprecated proxy params from Telegram bot integration (home-assistant#147288)
1 parent 6ce5945 commit 160163b

File tree

4 files changed

+1
-54
lines changed

4 files changed

+1
-54
lines changed

homeassistant/components/telegram_bot/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@
7272
CONF_ALLOWED_CHAT_IDS,
7373
CONF_BOT_COUNT,
7474
CONF_CONFIG_ENTRY_ID,
75-
CONF_PROXY_PARAMS,
7675
CONF_PROXY_URL,
7776
CONF_TRUSTED_NETWORKS,
7877
DEFAULT_TRUSTED_NETWORKS,
@@ -117,7 +116,6 @@
117116
),
118117
vol.Optional(ATTR_PARSER, default=PARSER_MD): cv.string,
119118
vol.Optional(CONF_PROXY_URL): cv.string,
120-
vol.Optional(CONF_PROXY_PARAMS): dict,
121119
# webhooks
122120
vol.Optional(CONF_URL): cv.url,
123121
vol.Optional(

homeassistant/components/telegram_bot/bot.py

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
)
3838
from homeassistant.core import Context, HomeAssistant
3939
from homeassistant.exceptions import HomeAssistantError, ServiceValidationError
40-
from homeassistant.helpers import issue_registry as ir
4140
from homeassistant.util.ssl import get_default_context, get_default_no_verify_context
4241

4342
from .const import (
@@ -77,7 +76,6 @@
7776
ATTR_USERNAME,
7877
ATTR_VERIFY_SSL,
7978
CONF_CHAT_ID,
80-
CONF_PROXY_PARAMS,
8179
CONF_PROXY_URL,
8280
DOMAIN,
8381
EVENT_TELEGRAM_CALLBACK,
@@ -877,52 +875,9 @@ def initialize_bot(hass: HomeAssistant, p_config: MappingProxyType[str, Any]) ->
877875
"""Initialize telegram bot with proxy support."""
878876
api_key: str = p_config[CONF_API_KEY]
879877
proxy_url: str | None = p_config.get(CONF_PROXY_URL)
880-
proxy_params: dict | None = p_config.get(CONF_PROXY_PARAMS)
881878

882879
if proxy_url is not None:
883-
auth = None
884-
if proxy_params is None:
885-
# CONF_PROXY_PARAMS has been kept for backwards compatibility.
886-
proxy_params = {}
887-
elif "username" in proxy_params and "password" in proxy_params:
888-
# Auth can actually be stuffed into the URL, but the docs have previously
889-
# indicated to put them here.
890-
auth = proxy_params.pop("username"), proxy_params.pop("password")
891-
ir.create_issue(
892-
hass,
893-
DOMAIN,
894-
"proxy_params_auth_deprecation",
895-
breaks_in_ha_version="2024.10.0",
896-
is_persistent=False,
897-
is_fixable=False,
898-
severity=ir.IssueSeverity.WARNING,
899-
translation_placeholders={
900-
"proxy_params": CONF_PROXY_PARAMS,
901-
"proxy_url": CONF_PROXY_URL,
902-
"telegram_bot": "Telegram bot",
903-
},
904-
translation_key="proxy_params_auth_deprecation",
905-
learn_more_url="https://github.com/home-assistant/core/pull/112778",
906-
)
907-
else:
908-
ir.create_issue(
909-
hass,
910-
DOMAIN,
911-
"proxy_params_deprecation",
912-
breaks_in_ha_version="2024.10.0",
913-
is_persistent=False,
914-
is_fixable=False,
915-
severity=ir.IssueSeverity.WARNING,
916-
translation_placeholders={
917-
"proxy_params": CONF_PROXY_PARAMS,
918-
"proxy_url": CONF_PROXY_URL,
919-
"httpx": "httpx",
920-
"telegram_bot": "Telegram bot",
921-
},
922-
translation_key="proxy_params_deprecation",
923-
learn_more_url="https://github.com/home-assistant/core/pull/112778",
924-
)
925-
proxy = httpx.Proxy(proxy_url, auth=auth, **proxy_params)
880+
proxy = httpx.Proxy(proxy_url)
926881
request = HTTPXRequest(connection_pool_size=8, proxy=proxy)
927882
else:
928883
request = HTTPXRequest(connection_pool_size=8)

homeassistant/components/telegram_bot/const.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
CONF_BOT_COUNT = "bot_count"
1414
CONF_ALLOWED_CHAT_IDS = "allowed_chat_ids"
1515
CONF_CONFIG_ENTRY_ID = "config_entry_id"
16-
CONF_PROXY_PARAMS = "proxy_params"
17-
1816

1917
CONF_PROXY_URL = "proxy_url"
2018
CONF_TRUSTED_NETWORKS = "trusted_networks"

homeassistant/components/telegram_bot/strings.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -924,10 +924,6 @@
924924
"proxy_params_auth_deprecation": {
925925
"title": "{telegram_bot}: Proxy authentication should be moved to the URL",
926926
"description": "Authentication details for the the proxy configured in the {telegram_bot} integration should be moved into the {proxy_url} instead. Please update your configuration and restart Home Assistant to fix this issue.\n\nThe {proxy_params} config key will be removed in a future release."
927-
},
928-
"proxy_params_deprecation": {
929-
"title": "{telegram_bot}: Proxy params option will be removed",
930-
"description": "The {proxy_params} config key for the {telegram_bot} integration will be removed in a future release.\n\nAuthentication can now be provided through the {proxy_url} key.\n\nThe underlying library has changed to {httpx} which is incompatible with previous parameters. If you still need this functionality for other options, please leave a comment on the learn more link.\n\nPlease update your configuration to remove the {proxy_params} key and restart Home Assistant to fix this issue."
931927
}
932928
}
933929
}

0 commit comments

Comments
 (0)