Python client for the etcd3 API
Project description
python-etcd3
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.
Free software: Apache Software License 2.0
Documentation: https://python-etcd3.readthedocs.io.
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
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
etcd3-0.8.0.tar.gz
(60.0 kB
view details)
Built Distribution
etcd3-0.8.0-py2.py3-none-any.whl
(38.9 kB
view details)
File details
Details for the file etcd3-0.8.0.tar.gz
.
File metadata
- Download URL: etcd3-0.8.0.tar.gz
- Upload date:
- Size: 60.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 896a1a529727798d8d20978a62532fd5e7bb5e4b9c5c00d50531132bcdabefac |
|
MD5 | 82a25c3dd553bfefb476e943781a104e |
|
BLAKE2b-256 | 8868341618eea2ce45d401d0d03180b01c1dc856a754a944ef4579cbbee8af24 |
File details
Details for the file etcd3-0.8.0-py2.py3-none-any.whl
.
File metadata
- Download URL: etcd3-0.8.0-py2.py3-none-any.whl
- Upload date:
- Size: 38.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e70b11e8c5769e4acc4e357358f15ae25897771c125c633a2f45e14af4c6abcb |
|
MD5 | 2c05a3ebe8493306635ea0aef50721e1 |
|
BLAKE2b-256 | 6f85410d53cf2a6132d3bc1ff9d0a32380a85aa0ea9df0ef081002c10e7ae318 |