This release is a pre-release and may not be stable for production use.
elastic-transport-python
Transport classes and utilities shared among Python Elastic client libraries
This library was lifted from elasticsearch-py
and then transformed to be used across all Elastic services
rather than only Elasticsearch.
Installing from PyPI
$ python -m pip install elastic-transport
Versioning follows the major and minor version of the Elastic Stack version and the patch number is incremented for bug fixes within a minor release.
User Guide
For almost all use-cases you should not need this library. The below use-cases are the common ones:
Creating your own Node Class
If you need to have custom behavior for a Node you can subclass the
base node class you want and then pass the class in via node_class:
from elastic_transport import Urllib3HttpNode
from elastic_enterprise_search import EnterpriseSearch
class CustomHttpNode(Urllib3HttpNode):
def perform_request(
self,
method,
target,
body=None,
request_timeout=DEFAULT,
ignore_status=(),
headers=None,
): ... # Custom HTTP behavior
# Create the Client with 'node_class' defined
client = EnterpriseSearch(
...,
node_class=CustomHttpNode
)
The above also works for NodePool (via node_pool_class) and Transport (via transport_class).
Nodes
A node describes a single instance of a service within a potentially larger cluster.
elastic-transport-python supports two HTTP client libraries:
Urllib3HttpNode
This is the default node class. This node class uses urllib3 to issue requests.
RequestsHttpNode
This node class requires the Requests library to be installed to use:
$ python -m pip install requests
This class is often useful when using libraries that integrate with Requests. Read more about Requests on Read the Docs.
Supported Node Options
The two node classes support a variety of options, some node classes only support a subset of the total options:
| Option | Description | Default | Supported by urllib3 | Supported by requests |
|---|---|---|---|---|
| host | TCP host to connect | localhost | ✓ | ✓ |
| port | TCP port to connect | ✓ | ✓ | |
| use_ssl | Should connect via TLS/SSL? | False | ✓ | ✓ |
| url_prefix | Path prefix for all requests | "" | ✓ | ✓ |
| request_timeout | Default request timeout | 10.0 | ✓ | ✓ |
| headers | HTTP headers to add to every request | {} | ✓ | ✓ |
| user_agent | Default User-Agent HTTP header | None | ✓ | ✓ |
| connections_per_node | Number of HTTP connections per Node | 10 | ✓ | |
| verify_certs | Whether to verify server certificate | True | ✓ | ✓ |
| ca_certs | CA certificates to use with TLS/SSL | certifi | ✓ | ✓ |
| client_cert | Client certificate to present during TLS/SSL handshake | None | ✓ | ✓ |
| client_key | Client certificate key that goes with client_cert | None | ✓ | ✓ |
| ssl_version | Version of TLS/SSL to use | None | ✓ | |
| ssl_assert_hostname | Host to verify on the server TLS certificate. Set to False to disable certificate hostname verification | None | ✓ | |
| ssl_assert_fingerprint | Checksum to verify against the server TLS certificate | None | ✓ | |
| ssl_context | Preconfigured SSLContext instance | None | ✓ |
License
elastic-transport-python is available under the Apache-2.0 license.
For more details see LICENSE.
Release files for elastic-transport 8.0.0a4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| elastic-transport-8.0.0a4.tar.gz | 43.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| elastic_transport-8.0.0a4-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 100.4 kB
Release files / elastic-transport-8.0.0a4.tar.gz
| Download URL | elastic-transport-8.0.0a4.tar.gz |
|---|---|
| Size | 43.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
69f64f2f442139effc1e9d0441d1c41528278005aeef773b9ad7a803fd1a5a2e
|
|
BLAKE2b-256 checksum How to use checksums |
8104119906e2eabba798a50042b720f34ba10efd7f943728f3e04f45c2c41e4f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2
|
Release files / elastic_transport-8.0.0a4-py2.py3-none-any.whl
| Download URL | elastic_transport-8.0.0a4-py2.py3-none-any.whl |
|---|---|
| Size | 57.1 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
e6449821a245a78c5cd2c998c7c40001ab98b301b801f490e4adacab0be2f7f0
|
|
BLAKE2b-256 checksum How to use checksums |
dfa5848f8d26a7fbcb70bc6a47275374b13367fc0a81bc9363f5e037a4b2c1b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2
|