Skip to main content

Fork of Python client for Consul (http://www.consul.io/) with some community and my patches.

Project description

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

Creators

Original code belongs to Andy Gayton. And fork with community patches belongs to Carlos.

Documentation

Original Library Documentation

Status

I'm using some of its function in production, so it's not a complete junk.

Example

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

Installation

pip3 install consul-reborn

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

[1.4.0] - 2020-06-17

Removed

  • consul.base Checks.compat as it was marked as deprecated.

Added

  • consul.base token argument for Agent.leave, Agent.force_leave and Event.list.

Fixed

  • consul.base some lint work.

[1.3.0] - 2019-06-27

Changed

  • Package name consul => consul-reborn. Because name Consul is occupied at PyPi.

[1.2.5] - 2019-06-27

Removed

  • tox.ini flake8 and Python2.
  • .travis.yml flake8 and Python2.

[1.2.4] - 2019-06-27

Fixed

  • setup.py.

[1.2.3] - 2019-06-27

Fixed

  • setup.py.

[1.2.2] - 2019-06-27

Fixed

  • README.md.
  • setup.py.

Changed

  • .travis.yml remove sonar and deploy stages.

Removed

  • .bumpversion.cfg.
  • sonar-project.properties.
  • Support of Python2.

[1.2.1] - 2019-06-26

Fixed

  • README.md.

[1.2.0] - 2019-06-26

Fixed

  • consul.base All methods of Session class use agent token if exists.
  • consul.base Minor linting.

Changed

  • README.md, CHANGELOG Converted to markdown.
  • setup.py Adjust.

Old Versions

1.1.0

  • 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

1.0.1

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

0.7.2

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

0.7.1

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

0.7.0

Features

  • Add Operator endpoint (thanks @bantonj!)

0.6.2

Bug Fix

  • Tornado backend encoding bug related to None values (thanks @plredmond)
  • python-consul doesn't support python 2.6 (thanks @lowzj)

Maintenance

  • update max ttl to 86400 to conform to consul (thanks @philloooo)
  • Correct error message in ACL create/update (thanks @Crypto89)

Features

  • Catalog API should support tokens (thanks @racktear!)
  • Allow enable tag override (thanks @shalev67!)

0.6.1

Features

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

Maintenance

  • Migrate readthedocs links from .org to .io (thanks @adamchainz)

0.6.0

Features

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

Maintenance

  • Test binaries updated to Consul 0.6.4
  • Tweaks to fix small updates to Consul's API

0.4.7

Features

  • Add ACL token support to agent.service.register and agent.check.register

0.4.6

Features

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

0.4.5

Features

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

0.4.4

Features

  • Support creation of ALCs with explicit ID. (thanks @KyleJamesWalker)

0.4.3

Features

  • Support 'dc' argument to health endpoints (thanks @etuttle!)

0.4.2

Features

  • Add status endpoints (thanks @cruatta!)

0.4.1

Features

  • Add health.node (thanks @davidbirdsong!)

0.4.0

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.

0.3.20

Features

  • Add Node and Service Maintenance (thanks @cruatta!)

Bug Fix

  • Unclosed connector Exception in consul.aio (thanks @jettify!)

0.3.19

Bug Fix

  • Fix six dependency (thanks @pawlowskimichal!)

0.3.18

Features

  • Adding ability to register checks with services (thanks @cruatta!)

Bug Fix

  • Fix distribution for consul.aio for python3 (thanks @mbachry!)

0.3.17

Features

  • Add address param to agent.service.register

0.3.16

Features

  • Add cas param for kv.delete (thanks @qix)

0.3.15

Features

  • Add tag parameter to health.service() (thanks @reversefold)

0.3.14

Features

  • add the keys and separator params to kv.get (thanks @Heuriskein)
  • add support for the events api (thanks @Heuriskein!)

0.3.13

Features

  • add HTTP check support (thanks @JoeHazzers)
  • raise ConsulException on kv.get 500 response code (thanks @jjpersch)
  • add the wait argument to kv.get

0.3.12

Features

  • add behavior and ttl to session.create
  • add session.renew

0.3.11

Features

  • add the health.state endpoint (thanks @pete0emerson!)
  • bump test binaries to 0.5.0

0.3.9

Bug Fix

  • Exclude consul.aio if asyncio isn't available, avoids an error message on install, trying to byte compile that module

0.3.8

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.

0.3.7

Features

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

0.3.6

Features

  • Add https support (thanks @pete0emerson)
  • Add wan param to agent.members (thanks @sgargan)

0.3.5

Bug Fix

  • Fix typo setting notes on a check (thanks @ShaheedHaque!)

0.3.4

Features

  • Add support for the Agent.Check (thanks @sgargan and @ShaheedHaque)

Deprecated

  • health.check.ttl_pass has been moved to agent.check.ttl_pass

0.3.3

Features

  • Add support for the Session API (Consul.Session)

Bug Fixes

0.3.2

Features

  • Add support for Python 3.4

0.3.1

Features

  • 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

0.3.0

Features

  • Add support for ACLs (Consul.ACL)

API changes (backwards incompatible)

  • For Consul.Agent.Service.register, rename check argument to script

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

consul-reborn-1.4.0.tar.gz (25.8 kB view details)

Uploaded Source

Built Distribution

consul_reborn-1.4.0-py2.py3-none-any.whl (27.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file consul-reborn-1.4.0.tar.gz.

File metadata

  • Download URL: consul-reborn-1.4.0.tar.gz
  • Upload date:
  • Size: 25.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.9

File hashes

Hashes for consul-reborn-1.4.0.tar.gz
Algorithm Hash digest
SHA256 09c8b5eed8192451cbf3280c1879cc8949491fee5a0f21962aa72fbce78efd7c
MD5 0dfdf2c70ef4e16e4401f7bbc1f9a19a
BLAKE2b-256 fdf2f91e799ae8006f68cf99ffea3e445efe53a55dec3c41d09d58c970341a26

See more details on using hashes here.

File details

Details for the file consul_reborn-1.4.0-py2.py3-none-any.whl.

File metadata

  • Download URL: consul_reborn-1.4.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 27.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.9

File hashes

Hashes for consul_reborn-1.4.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 63c5d870810bf4f894c46cd837025172a1b7ccc6e22cbc3fc931a428adf7ecff
MD5 7eb4560e7f07887c5b9b0b68e2da3bef
BLAKE2b-256 9c334146a6a7c1cc30c3a5442f8ef9eb8657f2c47086785b661571b75febbc1b

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