Skip to main content

Python client for the etcd3 API

Project description

python-etcd3

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.

Warning: this is a work in progress, many basic features do not have a stable API.

If you’re interested in using this library, please get involved.

This project is developed using Readme Driven Development, the most hip development methodology.

Fictitious example of api usage:

import etcd3

etcd = etcd3.client()
# or
etcd = etcd3.client(username='root',
                    password='hunter2',
                    host='127.0.0.1',
                    port=1234)

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

# watching
for event in etcd.watch('some-key'):
    print(event)

# 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'),
    ]
)

# admin stuff
member_id = etcd.add_member('newMember', peer_urls=['https://127.0.0.1:12345'])
etcd.update_member(member_id, peer_urls=['https://127.0.0.1:12345'])
etcd.remove_member(member_id)
for member in etcd.members:
    print(member.id, member.name, member.peer_addresses)
    member.remove()

Generating protobuf stuff

I ran:

python -m grpc.tools.protoc -Ietcd3/proto --python_out=etcd3/etcdrpc/ --grpc_python_out=etcd3/etcdrpc/ etcd3/proto/*.proto

from inside the python-etcd3 repo and it did stuff. Not sure if it did the correct stuff, but it output some python.

History

0.1.0 (2016-09-30)

  • First release on PyPI.

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

etcd3-0.2.1.tar.gz (21.4 kB view details)

Uploaded Source

File details

Details for the file etcd3-0.2.1.tar.gz.

File metadata

  • Download URL: etcd3-0.2.1.tar.gz
  • Upload date:
  • Size: 21.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for etcd3-0.2.1.tar.gz
Algorithm Hash digest
SHA256 5aa0e9eb2cc8c72fa82726c8ceb3df1322740a6058abfb6c28a0fd82b46be87e
MD5 6c7d433ca3ac5dc16a9a5414467158a5
BLAKE2b-256 d495e5a4e3aeef57ff3f09c5e14f3ad4b42da234a442d4719dfda3f0b8ec73b4

See more details on using hashes here.

Supported by

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