Python client for the etcd3 API (cslab fork)
Project description
cslab-etcd3
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.
Free software: Apache Software License 2.0
Original Repo: https://github.com/kragniz/python-etcd3
Fork Repo: https://github.com/reggiepy/python-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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36cc95442806264c46a89caaceb6042751cbc246d1baea6910019344d9be8e45
|
|
| MD5 |
73313eb013e0edcae348e1500d81eca1
|
|
| BLAKE2b-256 |
235581140496d60841afd98084128b6b1e8dc7127d312fcd91a988ce8f2b3053
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61a805cb2c7ac372380d3280de4043dc115d2dc4878188867998301cdf1d68ed
|
|
| MD5 |
2886471d55971829771cb0534f3466a6
|
|
| BLAKE2b-256 |
0a04826b05d6a8a6d80febad34fc7ea455bca1f043f4015475eda6f51733c98a
|