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.
Examples
Usage examples:
import consulsd service = consulsd.Client() service.register(id='flexlm1', name='flexlm', address='10.112.0.211', port=28518, tags=('flexlm1', light', 'v1'), check={'id': 'flexlm', 'name': 'flexlm on port 28518', 'tcp': '10.112.0.211:28518', 'Interval': '30s', 'timeout': '2s'}) service.deregister(id='flexlm1') service.list() service.info(name='flexlm')
The registration/deregistration is done using the consul agent API:
http://localhost:8500 PUT /v1/agent/service/register PUT /v1/agent/service/deregister/<serviceId>
To query the information the catalog API is used:
http://localhost:8500 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": "10.112.0.211", "Port": 28518, "Check": { "id": "flexlm", "name": "flexlm on port 28518", "tcp": "10.112.0.211:28518", "Interval": "30s", "timeout": "2s" } }
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
consul-sd-0.1.3.tar.gz
(2.5 kB
view details)
File details
Details for the file consul-sd-0.1.3.tar.gz
.
File metadata
- Download URL: consul-sd-0.1.3.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/2.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8910be42352f4a1e3ba64fe2e07fcfcc81a716b1d3667244c84b0d31251f3d8a |
|
MD5 | 697d8fd4c09fd4fb1734c4de21fbf378 |
|
BLAKE2b-256 | c0fe68f6748fb62a18fdaa5c6c123319385498245a54ee03bfe9e592472de20e |