Skip to main content

Python client for the etcd3 API

Project description

python-etcd3

https://img.shields.io/pypi/v/etcd3.svg https://img.shields.io/travis/kragniz/python-etcd3.svg Documentation Status Updates https://codecov.io/github/kragniz/python-etcd3/coverage.svg?branch=master

Python client for the etcd API v3, supported under python 2.7, 3.4 and 3.5.

Warning: the API is mostly stable, but may change in the future

If you’re interested in using this library, please get involved.

Basic usage:

import etcd3

etcd = etcd3.client()

etcd.get('foo')
etcd.put('bar', 'doot')
etcd.delete('bar')

# locks
lock = etcd.lock('thing')
# do something
lock.release()

with etcd.lock('doot-machine') as lock:
    # do something

# transactions
etcd.transaction(
    compare=[
        etcd.transactions.value('/doot/testing') == 'doot',
        etcd.transactions.version('/doot/testing') > 0,
    ],
    success=[
        etcd.transactions.put('/doot/testing', 'success'),
    ],
    failure=[
        etcd.transactions.put('/doot/testing', 'failure'),
    ]
)

# watch key
watch_count = 0
events_iterator, cancel = etcd.watch("/doot/watch")
for event in events_iterator:
    print(event)
    watch_count += 1
    if watch_count > 10:
        cancel()

# watch prefix
watch_count = 0
events_iterator, cancel = etcd.watch_prefix("/doot/watch/prefix/")
for event in events_iterator:
    print(event)
    watch_count += 1
    if watch_count > 10:
        cancel()

# recieve watch events via callback function
def watch_callback(event):
    print(event)

watch_id = etcd.add_watch_callback("/anotherkey", watch_callback)

# cancel watch
etcd.cancel_watch(watch_id)

History

0.1.0 (2016-09-30)

  • First release on PyPI.

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

etcd3-0.8.1.tar.gz (60.1 kB view details)

Uploaded Source

Built Distribution

etcd3-0.8.1-py2.py3-none-any.whl (38.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file etcd3-0.8.1.tar.gz.

File metadata

  • Download URL: etcd3-0.8.1.tar.gz
  • Upload date:
  • Size: 60.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for etcd3-0.8.1.tar.gz
Algorithm Hash digest
SHA256 0c8bc21dfa878df39450a019b1c4aed2e6680e679f8d8b0ec6f3a00906259c86
MD5 55884979c8129028c38b765af7dd087d
BLAKE2b-256 7fb476fceee000dcf4cdf1050d6923bcb2171e181d5a9ff3bd6fbdbcc800fbfb

See more details on using hashes here.

File details

Details for the file etcd3-0.8.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for etcd3-0.8.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 30fa20b41456aca7da985b127750438d372850e262e305769fc493cb9bdb8931
MD5 fa084ff0b02a695af339ae70e9153802
BLAKE2b-256 1cdc8eeb5f704a92ed0bdec323a9d99780e898c9cceb68089d6569f45a8330f7

See more details on using hashes here.

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