GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - kragniz/python-etcd3: Python client for the etcd API v3

BranchesTags
Open more actions menu

Latest commit

 

History

752 Commits
752 Commits

Folders and files

NameName
Last commit message
Last commit date
docs
docs
 
 
etcd3
etcd3
 
 
requirements
requirements
 
 
tests
tests
 
 
.build.yml
.build.yml
 
 
.dockerignore
.dockerignore
 
 
.gitignore
.gitignore
 
 
AUTHORS.rst
AUTHORS.rst
 
 
CONTRIBUTING.rst
CONTRIBUTING.rst
 
 
Dockerfile
Dockerfile
 
 
HISTORY.rst
HISTORY.rst
 
 
LICENSE
LICENSE
 
 
MANIFEST.in
MANIFEST.in
 
 
README.rst
README.rst
 
 
docker-compose.yml
docker-compose.yml
 
 
setup.cfg
setup.cfg
 
 
setup.py
setup.py
 
 
tox.ini
tox.ini
 
 

Repository files navigation

python-etcd3

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.

  • 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)

About

Python client for the etcd API v3

Topics

etcd

Resources

Readme
Apache-2.0 license

Contributing

Contributing
Activity

Stars

450 stars

Watchers

8 watching

Forks

193 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.