Skip to content

nixargh/python-consul

 
 

Repository files navigation

Python client for HashiCorp Consul

PyPi

This code is avaliable at PyPI as consul-reborn.

Creators

Original code belongs to Andy Gayton. And fork with community patches belongs to Carlos.

Disclamer

I don't like how it has been written but have no time for full refactoring, so I just fix issues that I crossed by. I do not fix CI or tests, sorry for that.

Status

I'm using some of its functions in production, so it's not a complete junk.

Documentation

Original Library Documentation

Example

import consul

c = consul.Consul()

# poll a key for updates
index = None
while True:
    index, data = c.kv.get('foo', index=index)
    print data['Value']

# in another process
c.kv.put('foo', 'bar')

Alternatively you can create a client from the same environment variables that the consul command line client uses. e.g. CONSUL_HTTP_ADDR, CONSUL_HTTP_TOKEN.

import consul

c = consul.Consul.from_env()

c.agent.self()

Installation

pip3 install consul-reborn

About

Python client for Consul (http://www.consul.io/)

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Python 100.0%