Skip to main content

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')
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)

Metadata

Release files for hippo-etcd3 0.12.0

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

Source distribution (sdist)

Source distribution for hippo-etcd3 0.12.0
File Size Uploaded
hippo_etcd3-0.12.0.tar.gz 41.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hippo-etcd3 0.12.0
File Interpreter ABI Platform
hippo_etcd3-0.12.0-py3-none-any.whl Python 3 none any Details

Total release size: 88.6 kB

Release files / hippo_etcd3-0.12.0.tar.gz

Download URL hippo_etcd3-0.12.0.tar.gz
Size 41.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b3531721b0c3bbab45fa2d42feb9e8001df483967a7c37cf47823090c97fff3f
BLAKE2b-256 checksum
How to use checksums
fb899c426f32dada6ebed43dcce8886f1e52cf7d7e12e88522d5adffd59297df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Release files / hippo_etcd3-0.12.0-py3-none-any.whl

Download URL hippo_etcd3-0.12.0-py3-none-any.whl
Size 47.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e19c31641bc08b2da8143bed4bd009c7a5343b2e10b87504464a43d6a08599b5
BLAKE2b-256 checksum
How to use checksums
21978963eee50a2950906ed99e1d765ce102ce32016b8ab1be1298838a749792
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Release history Release notifications | RSS feed

This release

0.12.0 This release

2 release files

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