Skip to main content

Python client for etcd v3 (Using grpc-json-gateway) Edit

Project description

etcd3-py

pypi travis codecov doc updates python3

Python client for etcd v3 (Using gRPC-JSON-Gateway)

Notice: The authentication header through gRPC-JSON-Gateway only supported in etcd v3.3+

Features

  • [x] Support python2.7 and python3.5+

  • [x] Sync client based on requests

  • [x] Async client based on aiohttp

  • [x] Support etcd3 gRPC-JSON-Gateway including stream

  • [x] Response modelizing based on etcd3’s swagger spec

  • [x] Generate code from swagger spec

  • [ ] TLS Connection

  • [x] support APIs

    • [x] Auth

    • [x] KV

    • [x] Watch

    • [x] Cluster

    • [x] Lease

    • [x] Maintenance

    • [x] Extra APIs

  • [ ] stateful utilities

    • [ ] Watch

    • [ ] Lease

    • [ ] Transaction

    • [ ] Lock

Quick Start

Install

$ pip install etcd3-py

Sync Client

>>> from etcd3 import Client
>>> client = Client('127.0.0.1', 2379)
>>> client.version()
EtcdVersion(etcdserver='3.3.0-rc.4', etcdcluster='3.3.0')
>>> client.put('foo', 'bar')
etcdserverpbPutResponse(header=etcdserverpbResponseHeader(cluster_id=11588568905070377092, member_id=128088275939295631, revision=15433, raft_term=4))
>>> client.range('foo').kvs
[mvccpbKeyValue(key=b'foo', create_revision=15429, mod_revision=15433, version=5, value=b'bar')]

Async Client (Python3.5+)

>>> import asyncio
>>> from etcd3 import AioClient
>>> client = AioClient('127.0.0.1', 2379)
>>> async def getFoo():
...     await client.put('foo', 'bar')
...     r = await client.range('foo')
...     print('key:', r.kvs[0].key, 'value:', r.kvs[0].value)
>>> loop = asyncio.get_event_loop()
>>> loop.run_until_complete(getFoo())
key: b'foo' value: b'bar'

TODO

  • [ ] benchmark

  • [ ] python-etcd(etcd v2) compatible client

  • [ ] etcd browser

History

0.0.1 (2018-01-26)

  • 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-py-0.1.1.tar.gz (67.5 kB view hashes)

Uploaded Source

Built Distribution

etcd3_py-0.1.1-py2.py3-none-any.whl (46.6 kB view hashes)

Uploaded Python 2 Python 3

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