Skip to main content

python-etcd documentation

A python client for Etcd https://github.com/coreos/etcd

Official documentation: http://python-etcd.readthedocs.org/

https://travis-ci.org/jplana/python-etcd.png?branch=master

Installation

Pre-requirements

Install etcd

From source

$ python setup.py install

Usage

Create a client object

import etcd

client = etcd.Client() # this will create a client against etcd server running on localhost on port 4001
client = etcd.Client(port=4002)
client = etcd.Client(host='127.0.0.1', port=4003)
client = etcd.Client(host='127.0.0.1', port=4003, allow_redirect=False) # wont let you run sensitive commands on non-leader machines, default is true

Set a key

client.set('/nodes/n1', 1)
# with ttl
client.set('/nodes/n2', 2, ttl=4)  # sets the ttl to 4 seconds

Get a key

client.get('/nodes/n2').value

Delete a key

client.delete('/nodes/n1')

Test and set

client.test_and_set('/nodes/n2', 2, 4) # will set /nodes/n2 's value to 2 only if its previous value was 4

Watch a key

client.watch('/nodes/n1') # will wait till the key is changed, and return once its changed

List sub keys

# List nodes in the cluster
client.get('/nodes')

# List keys under /subtree
client.get('/subtree')

Get machines in the cluster

client.machines

Get leader of the cluster

client.leader

Development setup

To create a buildout,

$ python bootstrap.py
$ bin/buildout

to test you should have etcd available in your system path:

$ bin/test

to generate documentation,

$ cd docs
$ make

Release HOWTO

To make a release

  1. Update release date/version in NEWS.txt and setup.py

  2. Run ‘python setup.py sdist’

  3. Test the generated source distribution in dist/

  4. Upload to PyPI: ‘python setup.py sdist register upload’

News

0.2.1

Release data: 30-Nov-2013

  • SSL support

  • Added support for subdirectories in results.

  • Improve test

  • Added support for reconnections, allowing death node tolerance.

0.2.0

Release data: 30-Sep-2013

  • Allow fetching of multiple keys (sub-nodes)

0.1

Release date: 18-Sep-2013

  • Initial release

Metadata

Release files for python-etcd 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-etcd 0.2.1
File Size Uploaded
python-etcd-0.2.1.tar.gz 13.2 kB Details

Release files / python-etcd-0.2.1.tar.gz

Download URL python-etcd-0.2.1.tar.gz
Size 13.2 kB
Tags Source
SHA-256 checksum
How to use checksums
27e6477883ae5952caf40a9c9fa50a18d8418b9f66cc5161d126692c34f41ea7
BLAKE2b-256 checksum
How to use checksums
4ef1921476a520dfae32efe7da4564d6f9701192c64e37c0ab94ab700e884575
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

0.4.5

1 release file

0.4.4

1 release file

0.4.3

1 release file

0.4.2

1 release file

0.4.1

1 release file

0.3.3

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.3.0

1 release file

This release

0.2.1 This release

1 release file

0.2.0

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page