Find service from Consul
Project description
Consul Service Finder
I got a problem when I try to simulate multiple service register on Consul server and the client can find one of the services to use the API.
I can use below URL to get all services but that is not what I want.
curl http://localhost:8500/v1/agent/services
Ideas
* Consul Query to search service by name
* Counte the service be used
* Return min count of services by same service name
Example
cs = ConsulServiceFinder()
# load query information from Consul
cs.queryLoadFromConsul()
cs.displayQuery()
# create query by service name
service_name = "my-service"
cs.createQueryByServiceName(service_name)
query_name = "query_" + service_name
cs.executeQuery(query_name)
# request one service from query
consulService = cs.requestOneService(query_name)
# compose service url from consulService object
print(cs.composeServiceUrl(consulService))
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
Built Distribution
Close
Hashes for consulservicefinder-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8441b001227c9392ae777b7f4f1d6cdc2c837c4fdc3fba92860fe5a23383e43f |
|
MD5 | 228eb314c8e7c7541c906a0c110820de |
|
BLAKE2b-256 | 7c0e04a290388b15c639ef146513c7a412c4297da352371ae847702eee5bd485 |
Close
Hashes for consulservicefinder-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62230b5c6ef89057358d342d4df9f8978da33de786f2c2619a312e2a72029bcd |
|
MD5 | ad2a02a907906494e3105442a85e40f3 |
|
BLAKE2b-256 | bdd0cc06c352b8076d237186643c24f68442c979e0a086dec08b0787149b9e3c |