etcd.client module

class etcd.client.Client(host='127.0.0.1', port=4001, is_ssl=False, ssl_do_verify=True, ssl_ca_bundle_filepath=None, ssl_client_cert_filepath=None, ssl_client_key_filepath=None)[source]

Bases: object

The main channel of functionality for the client. Connects to the server, and provides functions via properties.

Parameters:
  • host (string) – Hostname or IP of server
  • port (int) – Port of server
  • is_ssl (bool) – Whether to use ‘http://‘ or ‘https://‘.
  • ssl_do_verify (bool or None) – Whether to verify the certificate hostname.
  • ssl_ca_bundle_filepath (string or None) – A bundle of rootCAs for verifications.
  • ssl_client_cert_filepath (string or None) – A client certificate, for authentication.
  • ssl_client_key_filepath (string or None) – A client key, for authentication.
Raises:

ValueError

directory[source]

Return an instance of the class having the directory functionality.

Return type:etcd.directory_ops.DirectoryOps
inorder[source]

Return an instance of the class having the “in-order keys” functionality.

Return type:etcd.inorder_ops.InOrderOps
module[source]

Return an instance of the class that hosts the functionality provided by individual modules.

Return type:etcd.client._Modules
node[source]

Return an instance of the class having the general node functionality.

Return type:etcd.node_ops.NodeOps
prefix[source]

Return the URL prefix for the server.

Return type:string
send(version, verb, path, value=None, parameters=None, data=None, module=None, return_raw=False, allow_reconnect=True)[source]

Build and execute a request.

Parameters:
  • version (int) – Version of API
  • verb (string) – Verb of request (‘get’, ‘post’, etc..)
  • path (string) – URL path
  • value (scalar or None) – Value to be converted to string and passed as “value” in the POST data.
  • parameters (dictionary or None) – Dictionary of values to be passed via URL query.
  • data (dictionary or None) – Dictionary of values to be passed via POST data.
  • module (string or None) – Name of the etcd module that hosts the functionality.
  • return_raw (bool) – Whether to return a etcd.response.ResponseV2 object or the raw Requests response.
  • allow_reconnect (bool) – Allow the client to consider alternate hosts if the current host fails connection.
Returns:

Response object

Return type:

etcd.response.ResponseV2

server[source]

Return an instance of the class having the server functionality.

Return type:etcd.server_ops.ServerOps
session[source]
stat[source]

Return an instance of the class having the stat functionality.

Return type:etcd.stat_ops.StatOps