Skip to content

dkdhub/py-consul-tiny

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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/[email protected]
---

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.