Skip to main content

etcd3 package used in hippo

Project description

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hippo_etcd3-0.12.0.tar.gz (41.4 kB view details)

Uploaded Source

Built Distribution

hippo_etcd3-0.12.0-py3-none-any.whl (47.2 kB view details)

Uploaded Python 3

File details

Details for the file hippo_etcd3-0.12.0.tar.gz.

File metadata

  • Download URL: hippo_etcd3-0.12.0.tar.gz
  • Upload date:
  • Size: 41.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for hippo_etcd3-0.12.0.tar.gz
Algorithm Hash digest
SHA256 b3531721b0c3bbab45fa2d42feb9e8001df483967a7c37cf47823090c97fff3f
MD5 cc17bd0b8390b651ae905534b4f5a183
BLAKE2b-256 fb899c426f32dada6ebed43dcce8886f1e52cf7d7e12e88522d5adffd59297df

See more details on using hashes here.

File details

Details for the file hippo_etcd3-0.12.0-py3-none-any.whl.

File metadata

  • Download URL: hippo_etcd3-0.12.0-py3-none-any.whl
  • Upload date:
  • Size: 47.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for hippo_etcd3-0.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e19c31641bc08b2da8143bed4bd009c7a5343b2e10b87504464a43d6a08599b5
MD5 519f1119ed5cf91c043d24eb50d98b9d
BLAKE2b-256 21978963eee50a2950906ed99e1d765ce102ce32016b8ab1be1298838a749792

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page