Skip to main content

Python client for the etcd3 API (cslab fork)

Project description

cslab-etcd3

https://img.shields.io/pypi/v/cslab-etcd3.svg https://github.com/reggiepy/python-etcd3/actions/workflows/publish.yml/badge.svg

Python client for the etcd API v3, supported under python 2.7, 3.4 and 3.5. This is a fork of the original python-etcd3 package, renamed to cslab-etcd3.

Basic usage:

import etcd3

etcd = etcd3.client()

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

# locks
lock = etcd.lock('thing')
lock.acquire()
# 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)

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

watch_id = etcd.add_watch_prefix_callback("/doot/watch/prefix/", watch_callback)

# cancel watch
etcd.cancel_watch(watch_id)

History

0.12.1 (2025-03-13)

  • Rename package to cslab-etcd3.

  • Add GitHub Actions for automatic publishing.

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

cslab_etcd3-0.12.1.tar.gz (61.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cslab_etcd3-0.12.1-py2.py3-none-any.whl (39.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file cslab_etcd3-0.12.1.tar.gz.

File metadata

  • Download URL: cslab_etcd3-0.12.1.tar.gz
  • Upload date:
  • Size: 61.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cslab_etcd3-0.12.1.tar.gz
Algorithm Hash digest
SHA256 36cc95442806264c46a89caaceb6042751cbc246d1baea6910019344d9be8e45
MD5 73313eb013e0edcae348e1500d81eca1
BLAKE2b-256 235581140496d60841afd98084128b6b1e8dc7127d312fcd91a988ce8f2b3053

See more details on using hashes here.

File details

Details for the file cslab_etcd3-0.12.1-py2.py3-none-any.whl.

File metadata

  • Download URL: cslab_etcd3-0.12.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 39.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cslab_etcd3-0.12.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 61a805cb2c7ac372380d3280de4043dc115d2dc4878188867998301cdf1d68ed
MD5 2886471d55971829771cb0534f3466a6
BLAKE2b-256 0a04826b05d6a8a6d80febad34fc7ea455bca1f043f4015475eda6f51733c98a

See more details on using hashes here.

Supported by

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