Consul Service Discovery API
This module provides a simple way to work with the Consul Service Discovery API from python.
Examples
Usage examples:
import consul
service = consul.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 DELETE /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"
}
}
Metadata
Release files for consul-service-discovery 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| consul-service-discovery-0.1.2.tar.gz | 2.5 kB | Without provenance | Details for consul-service-discovery-0.1.2.tar.gz |
Release files / consul-service-discovery-0.1.2.tar.gz
| Download URL | consul-service-discovery-0.1.2.tar.gz |
|---|---|
| Size | 2.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9e9aafe10cc1abe6a175caa9ec59c05c86b5785646f1f41134db8797ad6bf007
|
|
BLAKE2b-256 checksum How to use checksums |
30035fc488559013fe50f70490d30db4a03b94eacfbdf9bf4bdf92338e7cd135
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for consul-service-discovery 0.1.2
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.