Client Utilities¶
Reusable utilities for creating API clients using elastic_transport
.
- class elastic_transport.client_utils.CloudId(cluster_name, es_address, kibana_address)¶
- class elastic_transport.client_utils.DefaultType(*values)¶
Sentinel used as a default value when
None
has special meaning like timeouts. The only comparisons that are supported for this type areis
.
- elastic_transport.client_utils.basic_auth_to_header(basic_auth)¶
Converts a 2-tuple into a ‘Basic’ HTTP Authorization header
- Return type:
- elastic_transport.client_utils.client_meta_version(version)¶
Converts a Python version into a version string compatible with the
X-Elastic-Client-Meta
HTTP header.- Return type:
- elastic_transport.client_utils.create_user_agent(name, version)¶
Creates the ‘User-Agent’ header given the library name and version
- Return type:
- elastic_transport.client_utils.parse_cloud_id(cloud_id)¶
Parses an Elastic Cloud ID into its components
- Return type:
- elastic_transport.client_utils.percent_encode(string, safe='/', encoding=None, errors=None)¶
Percent-encodes a string so it can be used in an HTTP request target
- Return type:
- elastic_transport.client_utils.resolve_default(val, default)¶
Resolves a value that could be the
DEFAULT
sentinel into either the given value or the default value.- Return type:
TypeVar
(T
)
- elastic_transport.client_utils.url_to_node_config(url, use_default_ports_for_scheme=False)¶
Constructs a
elastic_transport.NodeConfig
instance from a URL. If a username/password are specified in the URL they are converted to an ‘Authorization’ header. Always fills in a default port for HTTPS.- Parameters:
- Return type: