Fork of Python client for Consul (http://www.consul.io/) with some community and mine patches.
It's a fork of another fork https://github.com/nzlosh/python-consul.
The very first origin is https://github.com/cablehead/python-consul.
Python client for HashiCorp Consul
I'm using some of its function in production, so it's not a complete junk.
import consul c = consul.Consul() # poll a key for updates index = None while True: index, data = c.kv.get('foo', index=index) print data['Value'] # in another process c.kv.put('foo', 'bar')
Alternatively you can create a client from the same environment variables that the consul command line client uses. e.g. CONSUL_HTTP_ADDR, CONSUL_HTTP_TOKEN.
import consul c = consul.Consul.from_env() c.agent.self()
pip3 install consul
All notable changes to this project will be documented in this file.
[1.3.0] - 2019-06-27
- Package name consul => consul-reborn. Because name Consul is occupied at PyPi.
[1.2.5] - 2019-06-27
tox.iniflake8 and Python2.
.travis.ymlflake8 and Python2.
[1.2.4] - 2019-06-27
[1.2.3] - 2019-06-27
[1.2.2] - 2019-06-27
.travis.ymlremove sonar and deploy stages.
- Support of Python2.
[1.2.1] - 2019-06-26
[1.2.0] - 2019-06-26
consul.baseAll methods of Session class use agent token if exists.
CHANGELOGConverted to markdown.
- add support for nodemeta to catalog and health end points (thanks @ibrahimmenem)
- update Check.script to use args, as Consul 1.1 has dropped the script parameter
- Support for Python 3.4 dropped (sorry)
- Add support for Consul 1.0.0 (thanks @matusvalo!)
- Expose all 400 errors and add tests for common callback handler (thanks @bagerard)
- Add header parameter to http check (thanks @matusvalo)
- Add basic Transaction HTTP API support (thanks @iandyh)
- Fix invalid url error when specifying credentials via host (Issue #167)
- Add a common base client for shared functionality between different HTTP clients (thanks @abn!)
- Fix request quoting issue (thanks @abn)
- Fix installation issue due to aiohttp only being available for Python>=3.4.2 (thanks @abn)
- Added support for current release of aiohttp (thanks @eaterek)
- Improved Tornado example (thanks @chriswue)
- Add and use ACL token in Event.fire (thanks @illenseer)
- Add client side cert support (thanks @brocade-craig)
- Add token params to catalog register (thanks @gregdurham)
- Add support for DeregisterCriticalServiceAfter (thanks @daroot)
- Improve reliability of test suite (thanks @daroot!)
- Update CI: Add py35 and py36 to tests (thanks @Poogles)
- Add Operator endpoint (thanks @bantonj!)
- Tornado backend encoding bug related to None values (thanks @plredmond)
- python-consul doesn't support python 2.6 (thanks @lowzj)
- update max ttl to 86400 to conform to consul (thanks @philloooo)
- Correct error message in ACL create/update (thanks @Crypto89)
- Catalog API should support tokens (thanks @racktear!)
- Allow enable tag override (thanks @shalev67!)
- Add the coordinate endpoint and near support on Catalog and Health Checks (thanks @shalev67!)
- Rework all endpoints to use a common callback handler to help ensure consistent handling of responses (thanks @shalev67)
- Add Query api support (thanks @shalev67)
- Add token support for the Health endpoints (thanks @morpheu!)
- Force to use UTF-8 encoding for the response with the request's client (thanks @maxnasonov)
- Migrate readthedocs links from .org to .io (thanks @adamchainz)
- Add support for the new TCP and Docker health checks (thanks @abn)
- Add support for join and force-leave (thanks @abn)
- Use standard consul environment variables to override configuration (thanks @amayausky)
- Test binaries updated to Consul 0.6.4
- Tweaks to fix small updates to Consul's API
- Add ACL token support to agent.service.register and agent.check.register
- Add health.checks endpoint, update health TODOs (thanks @cruatta!)
- Improve error when a HTTP 503 status code is returned (thanks @raboof!)
- Added index and wait parameter to event.list (thanks @max0d41!)
- Allow SSL certificate verification to be disabled (thanks @jgadling!)
- Use requests.session for performance (thanks @msabramo!)
- Support 'wait' param for all blocking queries (thanks @rmt!)
- deduplicate query string when doing deletes with the std (requests) library (thanks @sduthil!)
- Support creation of ALCs with explicit ID. (thanks @KyleJamesWalker)
- Support 'dc' argument to health endpoints (thanks @etuttle!)
- Add status endpoints (thanks @cruatta!)
- Add health.node (thanks @davidbirdsong!)
API changes (backwards incompatible)
- Deprecated old health.check.ttl_pass call has been removed
- Deprecate loose parameters script, interval, ttl, http and timeout, to configure checks via agent.service.register and agent.check.register. Both methods now take a single argument to specify checks. A convenience consul.Check has been added to create checks.
- Add Node and Service Maintenance (thanks @cruatta!)
- Unclosed connector Exception in consul.aio (thanks @jettify!)
- Fix six dependency (thanks @pawlowskimichal!)
- Adding ability to register checks with services (thanks @cruatta!)
- Fix distribution for consul.aio for python3 (thanks @mbachry!)
- Add address param to agent.service.register
- Add cas param for kv.delete (thanks @qix)
- Add tag parameter to health.service() (thanks @reversefold)
- add the keys and separator params to kv.get (thanks @Heuriskein)
- add support for the events api (thanks @Heuriskein!)
- add HTTP check support (thanks @JoeHazzers)
- raise ConsulException on kv.get 500 response code (thanks @jjpersch)
- add the wait argument to kv.get
- add behavior and ttl to session.create
- add session.renew
- add the health.state endpoint (thanks @pete0emerson!)
- bump test binaries to 0.5.0
- Exclude consul.aio if asyncio isn't available, avoids an error message on install, trying to byte compile that module
API changes (backwards incompatible)
- Reorder named arguments to be more consistent. index is always the first named argument, if available, and dc is now always the last named argument.
- Add dc support for kv calls; add ability to set the default dc for an entire client session (thanks @angad)
- Add asyncio client (thanks @jettify)
- Add https support (thanks @pete0emerson)
- Add wan param to agent.members (thanks @sgargan)
- Fix typo setting notes on a check (thanks @ShaheedHaque!)
- Add support for the Agent.Check (thanks @sgargan and @ShaheedHaque)
- health.check.ttl_pass has been moved to agent.check.ttl_pass
- Add support for the Session API (Consul.Session)
- Fix a bug retrieving folder nodes from the KV store https://github.com/cablehead/python-consul/pull/6#issue-48589128 Thanks @zacman85
- Add support for Python 3.4
- Add support for the Catalog API (Consul.Catalog)
- Add ability to set a default consistency mode for an entire client session
- Add the ability to pass the consistency mode with kv.get
- Add support for ACLs (Consul.ACL)
API changes (backwards incompatible)
- For Consul.Agent.Service.register, rename check argument to script
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size & hash||File type||Python version||Upload date|
|consul_reborn-1.3.0-py2.py3-none-any.whl (26.8 kB) View hashes||Wheel||py2.py3|
|consul-reborn-1.3.0.tar.gz (29.3 kB) View hashes||Source||None|
Hashes for consul_reborn-1.3.0-py2.py3-none-any.whl