Python client for the etcd3 API
Project Links
Meta
Author: Louis Taylor
Classifiers
Development Status
- 2 - Pre-Alpha
Intended Audience
- Developers
License
- OSI Approved :: Apache Software License
Natural Language
- English
Programming Language
- Python :: 2
- Python :: 2.7
- Python :: 3
- Python :: 3.4
- Python :: 3.5
- Python :: 3.6
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')
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.1.0 (2016-09-30)
First release on PyPI.
0.12.0
Mar 31, 2020
0.11.1
Dec 08, 2019
0.11.0
Dec 07, 2019
0.10.0
Apr 11, 2019
0.9.0
Apr 10, 2019
0.8.1
Jun 18, 2018
0.8.0
May 07, 2018
0.7.0
Oct 04, 2017
0.6.2
Jun 22, 2017
0.6.1
Jun 21, 2017
0.6.0
Jun 13, 2017
0.5.2
Mar 24, 2017
0.5.1
Mar 16, 2017
0.5.0
Jan 05, 2017
0.4.0
Dec 05, 2016
0.3.1
Oct 27, 2016
0.3.0
Oct 26, 2016
0.2.2
Oct 20, 2016
0.2.1
Oct 20, 2016
0.2.0
Oct 16, 2016
Files in release
No dependencies