Skip to main content

py-consul PyPi version Python version Status Documentation

Status

This project is maintained and actively developed by Criteo. We aim at converging towards a full compatibility with the official Consul API.

We're currently supporting consul 1.20 up to 1.22. Due to quite a few changes since our development started (see section "A bit of history"), some endpoints are still partially handled.

Therefore, we are open to contributions and suggestions.

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

Installation

    pip install py-consul

Note: When using py-consul library in environment with proxy server, setting of http_proxy, https_proxy and no_proxy environment variables can be required for proper functionality.

A bit of history

The origin project python-consul is not maintained since 2018. As we were not able to get in touch with the maintainer (cablehead) to merge and release our PRs, we've forked the project in order to continue the maintenance of the project. We also renamed the project to be able to upload on pypi; see PyPI

Following some major changes, we decided to detach this fork from the original project and move from criteo fork space to criteo space.

Contributing

Please reach out if you're interested in being a maintainer as well. Otherwise, open a PR or Issue we'll try and respond as quickly as possible.

When you create a PR please ensure:

  • To add tests for your new features, if applicable
  • To add docstrings for new API features you may add

Change log

Since version 1.5.6, please refer to Releases

1.5.5

  • fix: Simplify loop handling in async Consul client

1.5.4

  • feature: Improve robustness of JSON decoding
  • feature: Add support for honoring additional arguments in consul.Consul()

1.5.3

  • feature: add replace_existing_checks option to agent.service.register()
  • revert: add replace_existing_checks option to Catalog.register()

1.5.2

  • feature: add replace_existing_checks option to Catalog.register()

1.5.1

  • feature: Implement creation of policies.
  • feature: Integrate policy addition during token creation.

1.5.0

  • [Breaking] ACL endpoint change, consul.acl is now consul.acl.token
  • feature: add consul.acl.policy.list and acl.policy.read

1.4.1

  • ci: fix package publishing and update GH actions versions

1.4.0 (unreleased)

  • [Breaking] due to the re-implementation of the ACL endpoint and the drop of the support of OSX and consul 1.1.0.
    • feature: re-implement some basic ACL endpoint
    • feature: drop support of OSX and consul 1.1.0
    • feature: support multi-check service registration (through extra_checks parameter)
    • env: support python 3.12
    • tests: multi consul version test (1.13.8, 1.15.4, 1.16.1, 1.17.3)
    • tests: add test utils for cleaner API output expected assertion
    • code-style: use ruff linter and formatter
    • code-style: split files following the consul API logic
    • ci: speedup ci with uv/tox-uv

1.3.0

  • feature: drop tornado and twisted support
  • env: support python 3.10 and 3.11
  • env: drop support of EOL python versions 3.5, 3.6, and 3.7
  • code-style: syntax modernization
  • code-style: formatter and linter use
  • ci: multiple python version test and linter enforcement

1.2.4

  • feature: aio: allow setting timeout by request

1.2.3

  • feature: base: ensure return format of json callback is more consistent

1.2.2

  • bugfix: connect: fix wrong endpoints callbacks

1.2.1

  • feature: Add support for context-managers
  • feature: Add support for /agent/service/:service_id API
  • bugfix: rename internal connect method

1.2.0

  • feature: Support deregister field in Check.script
  • feature: Introduce Consul Connect-related API wrappers
  • feature: Add token support missing in multiple methods
  • bugfix: aio: fix timeout type
  • feature: allow multiple tags in service health query

1.1.5

  • Dummy release to overcome a pypi release issue

1.1.4

  • bugfix: fixed connection_timeout usage for aiohttp

1.1.3

  • bugfix: fixed connection_limit usage for aiohttp

1.1.2

  • add support for connection_limit and connection_timeout in aiohttp
  • fix asyncio session close

1.1.1

  • Add support for python 3.7 and 3.8
  • Fix asyncio compatibility to support latest python version
  • Remove six dependency
  • Use new style of class declaration
  • Get rid of py3.4 old compat
  • Drop support of deprecated python2
  • base: allow weights parameter in service register

Base fork

Criteo starts forking this library from https://github.com/cablehead/python-consul

Metadata

Release files for py-consul 1.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-consul 1.8.0
File Size Uploaded Provenance Actions
py_consul-1.8.0.tar.gz 75.3 kB With provenance Details for py_consul-1.8.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for py-consul 1.8.0
File Interpreter ABI Platform Actions
py_consul-1.8.0-py2.py3-none-any.whl Python 3, Python 2 none any Details for py_consul-1.8.0-py2.py3-none-any.whl

Total release size: 131.4 kB

Release files / py_consul-1.8.0.tar.gz

Download URL py_consul-1.8.0.tar.gz
Size 75.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ed9ab0adb335d33ea84f7622f372411f8e288bb09aee5e7632264d28d285a52c
BLAKE2b-256 checksum
How to use checksums
da38fc6826e1685f3ead81d9bdc9a406ecf8dbc824aec93a23d9243e8b05099f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Release files / py_consul-1.8.0-py2.py3-none-any.whl

Download URL py_consul-1.8.0-py2.py3-none-any.whl
Size 56.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
242f45d66c97224ecd04ba1dd4eb71053ed5a38dc7bb9b9387d2a882f7352d59
BLAKE2b-256 checksum
How to use checksums
dd29c6f90c6bd5c1c90bc7ca93733adac02169b7ff6bd2c0694bce7af3fd7971
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Security for py-consul 1.8.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for py_consul-1.8.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page