Skip to main content

Transport classes and utilities shared among Python Elastic client libraries

Project description

elastic-transport-python

PyPI Python Versions PyPI Downloads CI Status

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.

elastic-transport-python supports Python 2.7 and Python 3.6+

User Guide

For almost all use-cases you should not need this library. The below use-cases are the common ones:

Creating your own Connection Class

If you need to have custom behavior for a Connection you can subclass the base connection class you want and then pass the class in via connection_class:

from elastic_transport import Urllib3HttpConnection
from elastic_enterprise_search import EnterpriseSearch


class CustomHttpConnection(Urllib3HttpConnection):
    ... # Custom HTTP behavior


# Create the Client with 'connection_class' defined
client = EnterpriseSearch(
    ...,
    connection_class=CustomHttpConnection
)

The above also works for ConnectionPool (via connection_pool_class) and Transport (via transport_class).

Connection Classes

elastic-transport-python supports two HTTP client libraries:

Urllib3HttpConnection

This is the default connection class. This connection class uses urllib3` to issue requests. Read more about urllib3 on Read the Docs.

RequestsHttpConnection

This connection 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 Connection Options

The two connection classes support a variety of options, some connection 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_host Number of HTTP connections per host 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

elastic-transport-7.11.0.tar.gz (27.0 kB view details)

Uploaded Source

Built Distribution

elastic_transport-7.11.0-py2.py3-none-any.whl (35.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file elastic-transport-7.11.0.tar.gz.

File metadata

  • Download URL: elastic-transport-7.11.0.tar.gz
  • Upload date:
  • Size: 27.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.9.0b3

File hashes

Hashes for elastic-transport-7.11.0.tar.gz
Algorithm Hash digest
SHA256 a6991ce690d6e4f49885ac5bd58f062ea512f4be25f068fc332e39f835f0b379
MD5 0f3a74d8a50bb50481b10e14467e46b6
BLAKE2b-256 7261971cba2e5217454d8d96da37dbbc57331692c6e5adfbd4b9085c4789afca

See more details on using hashes here.

Provenance

File details

Details for the file elastic_transport-7.11.0-py2.py3-none-any.whl.

File metadata

  • Download URL: elastic_transport-7.11.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 35.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.9.0b3

File hashes

Hashes for elastic_transport-7.11.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1589f11f448a65ce6a7b60207eafa45ee8279a396205f1ea4d6b7c8dbc9a8326
MD5 de7bac1d39e697bb5b99ef5b712357b1
BLAKE2b-256 8e74ccac65b7c411e28894d1daa950cca0b36f0babd0f03de29c2e020573e853

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page