Skip to content

Commit be16273

Browse files
authored
Remove deprecated url_prefix and use_ssl options (#2797)
1 parent db22037 commit be16273

File tree

1 file changed

+0
-37
lines changed

1 file changed

+0
-37
lines changed

elasticsearch/_sync/client/utils.py

-37
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,6 @@ def host_mapping_to_node_config(host: Mapping[str, Union[str, int]]) -> NodeConf
182182
"host",
183183
"port",
184184
"path_prefix",
185-
"url_prefix",
186-
"use_ssl",
187185
}
188186
disallowed_keys = set(host.keys()).difference(allow_hosts_keys)
189187
if disallowed_keys:
@@ -197,41 +195,6 @@ def host_mapping_to_node_config(host: Mapping[str, Union[str, int]]) -> NodeConf
197195

198196
options = dict(host)
199197

200-
# Handle the deprecated option 'use_ssl'
201-
if "use_ssl" in options:
202-
use_ssl = options.pop("use_ssl")
203-
if not isinstance(use_ssl, bool):
204-
raise TypeError("'use_ssl' must be of type 'bool'")
205-
206-
# Ensure the user isn't specifying scheme=http use_ssl=True or vice-versa
207-
if "scheme" in options and (options["scheme"] == "https") != use_ssl:
208-
raise ValueError(
209-
f"Cannot specify conflicting options 'scheme={options['scheme']}' "
210-
f"and 'use_ssl={use_ssl}'. Use 'scheme' only instead"
211-
)
212-
213-
warnings.warn(
214-
"The 'use_ssl' option is no longer needed as specifying a 'scheme' is now required",
215-
category=DeprecationWarning,
216-
stacklevel=warn_stacklevel(),
217-
)
218-
options.setdefault("scheme", "https" if use_ssl else "http")
219-
220-
# Handle the deprecated option 'url_prefix'
221-
if "url_prefix" in options:
222-
if "path_prefix" in options:
223-
raise ValueError(
224-
"Cannot specify conflicting options 'url_prefix' and "
225-
"'path_prefix'. Use 'path_prefix' only instead"
226-
)
227-
228-
warnings.warn(
229-
"The 'url_prefix' option is deprecated in favor of 'path_prefix'",
230-
category=DeprecationWarning,
231-
stacklevel=warn_stacklevel(),
232-
)
233-
options["path_prefix"] = options.pop("url_prefix")
234-
235198
return NodeConfig(**options) # type: ignore[arg-type]
236199

237200

0 commit comments

Comments
 (0)