https://github.com/cablehead/vanilla.consul
Vanilla (https://github.com/cablehead/vanilla) Python client for Consul (http://www.consul.io/)
https://github.com/cablehead/vanilla.consul
Last synced: about 2 months ago
JSON representation
Vanilla (https://github.com/cablehead/vanilla) Python client for Consul (http://www.consul.io/)
- Host: GitHub
- URL: https://github.com/cablehead/vanilla.consul
- Owner: cablehead
- Created: 2014-08-22T23:07:52.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2017-12-21T00:59:58.000Z (over 7 years ago)
- Last Synced: 2025-04-11T18:24:41.642Z (about 2 months ago)
- Language: Python
- Homepage:
- Size: 3.83 MB
- Stars: 8
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
`Vanilla`_ client for `Consul.io`_
==================================This is an adaptor/plugin for `Vanilla`_ based on the `python-consul`_ library.
Usage is the same as the `standard API`_ except that all API calls return a
Vanilla pipe, which can be *recv*'ed on to receive the Consul response.Example
-------.. code:: python
h = vanilla.Hub()
c = h.consul()class Config(object):
passconfig = Config()
@h.spawn
def monitor():
# register our service
c.agent.service.register(
'foo', service_id='foo:1', ttl='10s').recv()@h.spawn
def keepalive():
while True:
# ping our service's health check every 5s
c.health.check.ttl_pass('service:foo:1').recv()
h.sleep(5000)# maintain our internal configuration state with all available nodes
# providing the foo service
index = None
while True:
index, nodes = c.health.service(
'foo', index=index, passing=True).recv()
config.nodes = [node['Service']['ID'] for node in nodes]# make use of config.nodes
Installation
------------::
pip install vanilla.consul
.. _Consul.io: http://www.consul.io/
.. _Vanilla: https://github.com/cablehead/vanilla
.. _python-consul: http://python-consul.readthedocs.org
.. _standard API:
http://python-consul.readthedocs.org/en/latest/#api-documentation