{ "info": { "author": "Xavier Barbosa", "author_email": "clint.northwood@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Topic :: Software Development :: Quality Assurance", "Topic :: System :: Clustering", "Topic :: System :: Monitoring", "Topic :: System :: Networking :: Monitoring" ], "description": "AIO Consul\n----------\n\nConsul_ has multiple components, but as a whole, it is a tool for discovering and configuring services in your infrastructure, like :\n\n* Service Discovery\n* Health Checking\n* Key/Value Store\n* Multi Datacenter\n\n\nThis library provides several features to interact with its API. It is build in top of asyncio_ and aiohttp_. It works with Python >= 3.3, and is still a work in progress.\n\nThe documentation_ has more details, but sparsely this is how to work with it.\n\nInstallation\n~~~~~~~~~~~~\n\n::\n\n pip install aioconsul\n\n\nUsage\n~~~~~\n\nMost of the functions are coroutines, so it must be embedded into asyncio tasks::\n\n from aioconsul import Consul\n client = Consul()\n\n @asyncio.coroutine\n def main():\n node_name = yield from client.agent.config().node_name\n print('I am %s!' % node_name)\n\n loop = asyncio.get_event_loop()\n loop.run_until_complete(main)\n loop.run_until_complete(future)\n\n\nAgent checks\n~~~~~~~~~~~~\n\nCurrently this library can handle simple checks::\n\n from aioconsul import Consul\n client = Consul()\n\n # list all checks\n for check in (yield from client.agent.checks()):\n print(check.id)\n\n # look for a check\n check = yield from client.agent.checks.get('my-check')\n\n # register a script check\n check = yield from client.agent.checks.register_script('my-script-check',\n script='~/script.sh',\n interval='5m')\n\n # register a http check\n check = yield from client.agent.checks.register_ttl('my-http-check',\n http='http://example.com',\n interval='10h')\n\n # register a ttl check\n check = yield from client.agent.checks.register_ttl('my-ttl-check',\n ttl='10s')\n\n # mark ttl check passing\n yield from client.agent.checks.passing(check, note='Make it so')\n\n # deregister any check\n yield from client.agent.checks.deregister(check)\n\n\nAgent services\n~~~~~~~~~~~~~~\n\nCurrently this library can handle simple checks::\n\n from aioconsul import Consul\n client = Consul()\n\n # list all services\n for srv in (yield from client.agent.services()):\n print(srv.id)\n\n # search a service by its name\n srv = yield from client.agent.services.get('my-service')\n\n # disable a service\n yield from client.agent.services.maintenance(srv,\n enable=False,\n reason='Migrating stuff')\n\n # and reenable it\n yield from client.agent.services.maintenance(srv,\n enable=True,\n reason='Done')\n\n\nCatalog\n~~~~~~~\n\nThis library can consult catalog::\n\n from aioconsul import Consul\n client = Consul()\n\n # listing all nodes from catalog\n for node in (yield from client.catalog.nodes()):\n print(node.name)\n print(node.address)\n\n # getting a node with all of its service\n node = yield from client.catalog.get('my-node')\n print(node.services)\n\n # getting all nodes that belong to a service\n nodes = yield from client.catalog.nodes(service='my-service')\n print(nodes)\n\nAnd register checks, services and nodes::\n\n from aioconsul import Consul\n client = Consul()\n\n node = {'name': 'my-local-node',\n 'address': '127.0.0.1'}\n check = {'name': 'baz',\n 'state': 'passing',\n 'service_id': 'bar'}\n service={'name': 'bar'}\n\n resp = yield from client.catalog.register(node, check=check, service=service)\n assert resp\n\n resp = yield from client.catalog.deregister(node, check=check, service=service)\n assert resp\n\n\nEvents\n~~~~~~\n\n::\n\n from aioconsul import Consul\n client = Consul()\n\n # send an event\n event = yield from client.event.fire('my-event', node_filter='.*')\n\n # list all events\n for event in (yield from client.event.items()):\n print(event.name)\n\n\nHealth\n~~~~~~\n\n::\n\n from aioconsul import Consul\n client = Consul()\n\n # checks for a node\n for check in (yield from client.health.node('my-local-node')):\n assert check.status == 'passing'\n\n # health of a node\n for check in (yield from client.health.node('my-local-node')):\n assert check.status == 'passing'\n\n # health of a check id\n for check in (yield from client.health.checks('serfHealth')):\n assert check.status == 'passing'\n\n # health of a check id\n for check in (yield from client.health.checks('serfHealth')):\n assert check.status == 'passing'\n\n # health of a service\n for node in (yield from client.health.service('foo', state='any')):\n for check in node.checks:\n if check.id == 'service:foo':\n assert check.status == 'passing'\n\n # passing checks\n for check in (yield from client.health.state('passing')):\n assert check.status == 'passing'\n\n\nKV and Sessions\n~~~~~~~~~~~~~~~\n\nSimple example::\n\n from aioconsul import Consul\n client = Consul()\n\n # set a k/v\n yield from client.kv.set('my.key', 'my.value')\n\n # fetch a k/v\n obj = yield from client.kv.get('my.key')\n\n # fetched values have a special attribute `consul`\n assert obj.key.name == 'my.key'\n\n # delete a k/v\n yield from client.kv.delete('my.key')\n\n\nMany k/v::\n\n # list many k/v\n for key, value in (yield from client.kv.items('')):\n print(key, value)\n\n\nEphemeral k/v::\n\n session = yield from client.sessions.create(behavior='delete')\n yield from client.kv.create('my.key', 'my.key')\n yield from client.sessions.delete(session)\n\n try:\n # try to fetch previous k/v\n obj = yield from client.kv.get('my.key')\n except client.kv.NotFound:\n # but it was destroyed with the session\n pass\n\n\nACL\n~~~\n\n::\n\n from aioconsul import Consul, PermissionDenied\n client = Consul(token=master_token)\n\n # create a token\n token = (yield from client.acl.create('my-acl', rules=[\n ('key', '', 'read'),\n ('key', 'foo/', 'deny'),\n ]))\n\n # access to kv with the fresh token\n node = Consul(token=token)\n yield from node.kv.get('foo')\n with pytest.raises(PermissionDenied):\n yield from node.kv.set('foo', 'baz')\n with pytest.raises(node.kv.NotFound):\n yield from node.kv.get('foo/bar')\n\n\nTesting\n~~~~~~~\n\nTests rely on Consul_ binary and `py.test`_.\n\n1. Install consul binary, it must be reachable in your ``$PATH``.\n2. Install test requirements::\n\n pip install -r requirements-tests.txt\n\n3. Then run tests::\n\n py.test --cov-report html --cov aioconsul tests\n\n\nPublish to pypi\n---------------\n\n::\n\n python setup.py sdist bdist_wheel upload\n\n\nCredits\n-------\n\n- Consul_\n- aiohttp_\n- asyncio_\n- `py.test`_\n\n\n.. _Consul: http://consul.io\n.. _aiohttp: http://aiohttp.readthedocs.org\n.. _asyncio: http://asyncio.org\n.. _`py.test`: http://pytest.org\n.. _documentation: http://aioconsul.readthedocs.org", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/johnnoone/aioconsul", "keywords": "infrastructure,asyncio,service discovery,health checking,key/value store", "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "aioconsul", "package_url": "https://pypi.org/project/aioconsul/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/aioconsul/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/johnnoone/aioconsul" }, "release_url": "https://pypi.org/project/aioconsul/0.3/", "requires_dist": null, "requires_python": null, "summary": "Consul wrapper for asyncio", "version": "0.3" }, "last_serial": 2431437, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "4cf567317b91361e90ab7b74bbdecc57", "sha256": "f35eba426c19f46f71850454f4467ec6d9b2f5e0e5bfc2c75373787f8a633d11" }, "downloads": -1, "filename": "aioconsul-0.1.tar.gz", "has_sig": false, "md5_digest": "4cf567317b91361e90ab7b74bbdecc57", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8623, "upload_time": "2015-03-23T17:43:12", "url": "https://files.pythonhosted.org/packages/ad/b3/f592a5b941cded8c3f24b06fc6727c412987cd7b158eb4d5107c60c31039/aioconsul-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "1c6375c2a09406bf5978b7886421c610", "sha256": "4faae4980ea1e3759cf115ba087c43215b759611994448c92ce530d4d58ecefb" }, "downloads": -1, "filename": "aioconsul-0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "1c6375c2a09406bf5978b7886421c610", "packagetype": "bdist_wheel", "python_version": "3.4", "requires_python": null, "size": 13375, "upload_time": "2015-03-24T12:33:03", "url": "https://files.pythonhosted.org/packages/8e/49/8769c76a148aa34a9b1a02f374845f2d8fc89974f03d80dfa2888d20c28c/aioconsul-0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "773901116c15c86c3f1b11248e35f7b7", "sha256": "b444a3b8e3398fc55c651780b586cd42f06d70ef6c4e7a854be9b6c7b24e6eaf" }, "downloads": -1, "filename": "aioconsul-0.2.tar.gz", "has_sig": false, "md5_digest": "773901116c15c86c3f1b11248e35f7b7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8948, "upload_time": "2015-03-24T12:33:00", "url": "https://files.pythonhosted.org/packages/0b/94/ef62aafee1fa3110a8a80e8455441446f6cd59c8c86140e43cf71c60608f/aioconsul-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "5c40e7d3a0e9fc8d51f0b909d6bee1f1", "sha256": "91484cb18760ede28a1a912457643fa09b320d4eebfb1d0fff636566e27bb3fc" }, "downloads": -1, "filename": "aioconsul-0.3.tar.gz", "has_sig": false, "md5_digest": "5c40e7d3a0e9fc8d51f0b909d6bee1f1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19399, "upload_time": "2015-06-04T03:03:04", "url": "https://files.pythonhosted.org/packages/24/a1/33ad714c1f8f0a7a7e1bfbf8d0aa42e95a74aa42bb610c1ef27b33503973/aioconsul-0.3.tar.gz" } ], "0.7.0a1": [ { "comment_text": "", "digests": { "md5": "1d5ce31f5e2f1a608bdc8e6cb558930a", "sha256": "fd0ec7d780be1dc217a8f6efdd56946630f6cd980f3657736f9413881251851d" }, "downloads": -1, "filename": "aioconsul-0.7.0a1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "1d5ce31f5e2f1a608bdc8e6cb558930a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 41488, "upload_time": "2016-10-23T00:35:48", "url": "https://files.pythonhosted.org/packages/c0/80/19e13d1a2a6cde4f070864f2d88aa4eb84c69595fe8ca21cb8121e61fb97/aioconsul-0.7.0a1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "17020be962bf5541a3890203cc6de6a1", "sha256": "af5121dc2be4fef5a6f7b362cba6071d869ceb843d89218bb6c03fcdfbd92597" }, "downloads": -1, "filename": "aioconsul-0.7.0a1.tar.gz", "has_sig": false, "md5_digest": "17020be962bf5541a3890203cc6de6a1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 45516, "upload_time": "2016-10-23T00:35:51", "url": "https://files.pythonhosted.org/packages/a5/f1/f7db121208f8b7ddbf4d9c281a1361f5b5fa1e44ab9b1131f5909bbe71bc/aioconsul-0.7.0a1.tar.gz" } ], "0.7.0a2": [ { "comment_text": "", "digests": { "md5": "ac9d1fe035bea98d1cd16fdecc6e30bf", "sha256": "d5b44280cab1e0d2582d08c3320abdbb872ce0ff9fc327761b5eb33d6dafcf48" }, "downloads": -1, "filename": "aioconsul-0.7.0a2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ac9d1fe035bea98d1cd16fdecc6e30bf", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 47353, "upload_time": "2016-10-30T11:58:35", "url": "https://files.pythonhosted.org/packages/9c/58/72f04fd82482dd98100df6df012c56a30643b18bb103a2b38d773d0df187/aioconsul-0.7.0a2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ee5e741415b736509c84142054726fa5", "sha256": "bf5da5a7d210520a3b7eb13d95ff1a3a482c494a0c47a0abb23437b34811cad9" }, "downloads": -1, "filename": "aioconsul-0.7.0a2.tar.gz", "has_sig": false, "md5_digest": "ee5e741415b736509c84142054726fa5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 50002, "upload_time": "2016-10-30T11:58:40", "url": "https://files.pythonhosted.org/packages/59/82/2c1f2ab31ab32917fc0fac88d8c0c0664ccc666cecf246a906f6f4930bdb/aioconsul-0.7.0a2.tar.gz" } ], "0.7.0rc1": [ { "comment_text": "", "digests": { "md5": "612a73e3740c72d17305d926b6f74d94", "sha256": "d9a662120952bd951c6004a705f5b6f6b9549450f75129b1d48929c50d33516d" }, "downloads": -1, "filename": "aioconsul-0.7.0rc1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "612a73e3740c72d17305d926b6f74d94", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 47482, "upload_time": "2016-10-30T13:12:23", "url": "https://files.pythonhosted.org/packages/e8/85/eae83d8fbca8c287f044229704e291225d5b25c603f5774b4c98930c279d/aioconsul-0.7.0rc1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3620acdd19cc2ec544ab12d83f78325b", "sha256": "d3ad577bc3bf675b2b6dd2de3706a0c652c19c06b375c73da23f0a4a0866982d" }, "downloads": -1, "filename": "aioconsul-0.7.0rc1.tar.gz", "has_sig": false, "md5_digest": "3620acdd19cc2ec544ab12d83f78325b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 50112, "upload_time": "2016-10-30T13:12:26", "url": "https://files.pythonhosted.org/packages/1f/7c/10d89fcaf9048ac35ec91c50bcc7550961c3b7dbd53f6cc4bf57ff8ca413/aioconsul-0.7.0rc1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5c40e7d3a0e9fc8d51f0b909d6bee1f1", "sha256": "91484cb18760ede28a1a912457643fa09b320d4eebfb1d0fff636566e27bb3fc" }, "downloads": -1, "filename": "aioconsul-0.3.tar.gz", "has_sig": false, "md5_digest": "5c40e7d3a0e9fc8d51f0b909d6bee1f1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19399, "upload_time": "2015-06-04T03:03:04", "url": "https://files.pythonhosted.org/packages/24/a1/33ad714c1f8f0a7a7e1bfbf8d0aa42e95a74aa42bb610c1ef27b33503973/aioconsul-0.3.tar.gz" } ] }