Skip to main content

Python client for Consul Service Discovery API

Project description

Consul Service Discovery API

This module provides a simple way to work with the Consul Service Discovery API from python.


Usage examples:

import consulsd
service = consulsd.Client()
service.register(id='flexlm1', name='flexlm',
            address='', port=28518,
            tags=('flexlm1', light', 'v1'),
            check={'id': 'flexlm', 'name': 'flexlm on port 28518',
                   'tcp': '',
                   'Interval': '30s', 'timeout': '2s'})

The registration/deregistration is done using the consul agent API:

PUT /v1/agent/service/register
PUT /v1/agent/service/deregister/<serviceId>

To query the information the catalog API is used:

GET /v1/catalog/services
GET /v1/catalog/service/bigdata
GET /v1/catalog/nodes
GET /v1/catalog/node/c13-9

The payload for the registration request has the following format:

  "ID": "flexlm1",
  "Name": "flexlm",
  "Tags": ["flexlm1", light", "v1"],
  "Address": "",
  "Port": 28518,
  "Check": {
    "id": "flexlm",
    "name": "flexlm on port 28518",
    "tcp": "",
    "Interval": "30s",
    "timeout": "2s"

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for consul-sd, version 0.1.3
Filename, size & hash File type Python version Upload date
consul-sd-0.1.3.tar.gz (2.5 kB) View hashes Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page