Fork of https://github.com/kragniz/python-etcd3
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')
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.
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 Distributions
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 etcd3-rs-0.13.0.tar.gz.
File metadata
- Download URL: etcd3-rs-0.13.0.tar.gz
- Upload date:
- Size: 67.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
530a995cd79ad1de452bbc5eb740cebf90c193c2b3d8e5dd4de528c977b0b62a
|
|
| MD5 |
9dd59a7c6d30c65888cbee341b39c136
|
|
| BLAKE2b-256 |
152791b830d32a3f07e4f6bc798c0cec45637a7d8c23f9bb90eaf2f784b5d5da
|
File details
Details for the file etcd3_rs-0.13.0-py3.10.egg.
File metadata
- Download URL: etcd3_rs-0.13.0-py3.10.egg
- Upload date:
- Size: 94.6 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1238f3fa0df192c76cf2db168c31beb32d53d536d727f3f079e24374da14048
|
|
| MD5 |
1e5dd89025ea62086b3121f9642a0ccc
|
|
| BLAKE2b-256 |
6dfd6a6d9122e412516c7cab2f4221b66d4fdcf2dca86fd1598508ae02973047
|
File details
Details for the file etcd3_rs-0.13.0-py2.py3-none-any.whl.
File metadata
- Download URL: etcd3_rs-0.13.0-py2.py3-none-any.whl
- Upload date:
- Size: 45.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ebf2a78c2f295a4b6d874e9695fdedeef12bbb0bda80bfd1c6dafd552aeba1eb
|
|
| MD5 |
eb75964db38dee7e7679875a7b0f6de1
|
|
| BLAKE2b-256 |
54aa593c704508e40ddbaf383f6e997ef5e4e614b4df82b68d6bae23fc1bb66c
|