py-consul-tiny
Python3 Tiny Client for Hashicorp Consul
Install
as for
virtualenv
---
$ virtualenv .env
$ . .env/bin/activate
(.env) $ pip install -U git+https://github.com/dkdhub/py-consul-tiny.git@v0.1.0
---
Usage
import logging
import time
from consul.agent import ConsulAgent
logging.basicConfig(level=logging.DEBUG)
agent = ConsulAgent(consul_address="127.0.0.1:8500",
service='agent-test-service',
tls=False,
catalog_node='consul')
agent.set_heartbeat_message("127.1.1.1", 9876)
logger = logging.getLogger(__name__)
with agent:
while True:
time.sleep(10)
logger.info("I'm alive!")
License
© 2023 UPD Consulting Ltd
Distributed under the MIT license.