{ "info": { "author": "Jose Plana", "author_email": "jplana@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Topic :: Database :: Front-Ends", "Topic :: Software Development :: Libraries", "Topic :: System :: Distributed Computing" ], "description": "python-etcd documentation\n=========================\n\nA python client for Etcd https://github.com/coreos/etcd\n\nOfficial documentation: http://python-etcd.readthedocs.org/\n\n.. image:: https://travis-ci.org/jplana/python-etcd.png?branch=master\n :target: https://travis-ci.org/jplana/python-etcd\n\nInstallation\n------------\n\nPre-requirements\n~~~~~~~~~~~~~~~~\n\nInstall etcd (0.2.rc1 or later). This version of python-etcd will only work correctly with the etcd API version 2.\n\nThis client is known to work with python 2.7 and with python 3.3 or above. It is not tested or expected to work in more outddated versions of python.\n\nFrom source\n~~~~~~~~~~~\n\n.. code:: bash\n\n $ python setup.py install\n\nUsage\n-----\n\nThe basic methods of the client have changed compared to previous versions, to reflect the new API structure; however a compatibility layer has been maintained so that you don't necessarily need to rewrite all your existing code.\n\nCreate a client object\n~~~~~~~~~~~~~~~~~~~~~~\n\n.. code:: python\n\n import etcd\n\n client = etcd.Client() # this will create a client against etcd server running on localhost on port 4001\n client = etcd.Client(port=4002)\n client = etcd.Client(host='127.0.0.1', port=4003)\n client = etcd.Client(host='127.0.0.1', port=4003, allow_redirect=False) # wont let you run sensitive commands on non-leader machines, default is true\n # create a client against https://api.example.com:443/etcd\n client = etcd.Client(host='api.example.com', protocol='https', port=443, version_prefix='/etcd')\nWrite a key\n~~~~~~~~~\n\n.. code:: python\n\n client.write('/nodes/n1', 1)\n # with ttl\n client.write('/nodes/n2', 2, ttl=4) # sets the ttl to 4 seconds\n client.set('/nodes/n2', 1) # Equivalent, for compatibility reasons.\n\nRead a key\n~~~~~~~~~\n\n.. code:: python\n\n client.read('/nodes/n2').value\n client.read('/nodes', recursive = True) #get all the values of a directory, recursively.\n client.get('/nodes/n2').value\n\nDelete a key\n~~~~~~~~~~~~\n\n.. code:: python\n\n client.delete('/nodes/n1')\n\nAtomic Compare and Swap\n~~~~~~~~~~~~\n\n.. code:: python\n\n client.write('/nodes/n2', 2, prevValue = 4) # will set /nodes/n2 's value to 2 only if its previous value was 4 and\n client.write('/nodes/n2', 2, prevExist = False) # will set /nodes/n2 's value to 2 only if the key did not exist before\n client.write('/nodes/n2', 2, prevIndex = 30) # will set /nodes/n2 's value to 2 only if the key was last modified at index 30\n client.test_and_set('/nodes/n2', 2, 4) #equivalent to client.write('/nodes/n2', 2, prevValue = 4)\n\nYou can also atomically update a result:\n\n.. code:: python\n\n result = client.read('/foo')\n print(result.value) # bar\n result.value += u'bar'\n updated = client.update(result) # if any other client wrote '/foo' in the meantime this will fail\n print(updated.value) # barbar\n\nWatch a key\n~~~~~~~~~~~\n\n.. code:: python\n\n client.read('/nodes/n1', wait = True) # will wait till the key is changed, and return once its changed\n client.read('/nodes/n1', wait = True, timeout=30) # will wait till the key is changed, and return once its changed, or exit with an exception after 30 seconds.\n client.read('/nodes/n1', wait = True, waitIndex = 10) # get all changes on this key starting from index 10\n client.watch('/nodes/n1') #equivalent to client.read('/nodes/n1', wait = True)\n client.watch('/nodes/n1', index = 10)\n\nLocking module\n~~~~~~~~~~~~~~\n\n.. code:: python\n\n # Initialize the lock object:\n # NOTE: this does not acquire a lock yet\n client = etcd.Client()\n lock = client.get_lock('/customer1', ttl=60)\n\n # Use the lock object:\n lock.acquire(timeout=30) #returns if lock could not be acquired within 30 seconds\n lock.is_locked() # True\n lock.renew(60)\n lock.release()\n lock.is_locked() # False\n\n # The lock object may also be used as a context manager:\n client = etcd.Client()\n lock = client.get_lock('/customer1', ttl=60)\n with lock as my_lock:\n do_stuff()\n lock.is_locked() # True\n lock.renew(60)\n lock.is_locked() # False\n\n\nLeader Election module\n~~~~~~~~~~~~~~~~~~~~~~\n\n.. code:: python\n\n # Set a leader object with a name; if no name is given, the local hostname\n # is used.\n # Zero or no ttl means the leader object is persistent.\n client = etcd.Client()\n client.election.set('/mysql', name='foo.example.com', ttl=120, timeout=30) # returns the etcd index\n\n # Get the name\n print(client.election.get('/mysql')) # 'foo.example.com'\n # Delete it!\n print(client.election.delete('/mysql', name='foo.example.com'))\n\nGet machines in the cluster\n~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code:: python\n\n client.machines\n\nGet leader of the cluster\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code:: python\n\n client.leader\n\nDevelopment setup\n-----------------\n\nTo create a buildout,\n\n.. code:: bash\n\n $ python bootstrap.py\n $ bin/buildout\n\nto test you should have etcd available in your system path:\n\n.. code:: bash\n\n $ bin/test\n\nto generate documentation,\n\n.. code:: bash\n\n $ cd docs\n $ make\n\nRelease HOWTO\n-------------\n\nTo make a release\n\n 1) Update release date/version in NEWS.txt and setup.py\n 2) Run 'python setup.py sdist'\n 3) Test the generated source distribution in dist/\n 4) Upload to PyPI: 'python setup.py sdist register upload'\n\n\nNews\n====\n\n0.3.4\n-----\n\n* Retry in a bigger number of exceptions\n\n0.3.3\n-----\n*Release date: 12-Apr-2015*\n\n* Forward leaves_only value in get_subtree() recursive calls\n* Fix README prevExists->prevExist\n* Added configurable version_prefix\n* Added support for recursive watch\n* Better error handling support (more detailed exceptions)\n* Fixed some unreliable tests\n* Fix bad .format usage for Python 2.6\n* Change package name to python-etcd-azion\n\n\n0.3.2\n-----\n\n*Release date: 4-Aug-2014*\n\n* Fixed generated documentation version.\n\n\n0.3.1\n-----\n\n*Release date: 4-Aug-2014*\n\n* Added consisten read option\n* Fixed timeout parameter in read()\n* Added atomic delete parameter support\n* Fixed delete behaviour\n* Added update method that allows atomic updated on results\n* Fixed checks on write()\n* Added leaves generator to EtcdResult and get_subtree for recursive fetch\n* Added etcd_index to EtcdResult\n* Changed ethernal -> eternal\n* Updated urllib3 & pyOpenSSL libraries\n* Several performance fixes\n* Better parsing of etcd_index and raft_index\n* Removed duplicated tests\n* Added several integration and unit tests\n* Use etcd v0.3.0 in travis\n* Execute test using `python setup.py test` and nose\n\n\n0.3.0\n-----\n\n*Release date: 18-Jan-2014*\n\n* API v2 support\n* Python 3.3 compatibility\n\n\n0.2.1\n-----\n\n*Release data: 30-Nov-2013*\n\n* SSL support\n* Added support for subdirectories in results.\n* Improve test\n* Added support for reconnections, allowing death node tolerance.\n\n\n0.2.0\n-----\n\n*Release date: 30-Sep-2013*\n\n* Allow fetching of multiple keys (sub-nodes)\n\n\n0.1\n---\n\n*Release date: 18-Sep-2013*\n\n* Initial release", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/aziontech/python-etcd", "keywords": "etcd raft distributed log api client - Azion's fork", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "python-etcd-azion", "package_url": "https://pypi.org/project/python-etcd-azion/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/python-etcd-azion/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/aziontech/python-etcd" }, "release_url": "https://pypi.org/project/python-etcd-azion/0.3.4/", "requires_dist": null, "requires_python": null, "summary": "A python client for etcd - Azion's fork", "version": "0.3.4" }, "last_serial": 2755605, "releases": { "0.3.3": [ { "comment_text": "", "digests": { "md5": "86fe08cb4be8f397db92715b77a02e32", "sha256": "0e147338de793029c52c582138e451f12ad5d8dda1aab89da36f8c1f0f704c12" }, "downloads": -1, "filename": "python-etcd-azion-0.3.3.tar.gz", "has_sig": false, "md5_digest": "86fe08cb4be8f397db92715b77a02e32", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23495, "upload_time": "2015-11-05T11:46:32", "url": "https://files.pythonhosted.org/packages/3b/32/7a3b5e078b102ebb298c82c3862a88cd99928666cea1016b43e24f00e763/python-etcd-azion-0.3.3.tar.gz" } ], "0.3.4": [ { "comment_text": "", "digests": { "md5": "c7b46da923f0d9476ff4507937278e93", "sha256": "ed52fc682a14d5b18903340a827640bad2d548394807189171221b23a360501a" }, "downloads": -1, "filename": "python-etcd-azion-0.3.4.tar.gz", "has_sig": false, "md5_digest": "c7b46da923f0d9476ff4507937278e93", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23638, "upload_time": "2017-04-05T17:26:12", "url": "https://files.pythonhosted.org/packages/47/95/aa4e179d3fb746725b30ec16f777c962c55cbe3b0aeb9d8185e10f24d413/python-etcd-azion-0.3.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c7b46da923f0d9476ff4507937278e93", "sha256": "ed52fc682a14d5b18903340a827640bad2d548394807189171221b23a360501a" }, "downloads": -1, "filename": "python-etcd-azion-0.3.4.tar.gz", "has_sig": false, "md5_digest": "c7b46da923f0d9476ff4507937278e93", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23638, "upload_time": "2017-04-05T17:26:12", "url": "https://files.pythonhosted.org/packages/47/95/aa4e179d3fb746725b30ec16f777c962c55cbe3b0aeb9d8185e10f24d413/python-etcd-azion-0.3.4.tar.gz" } ] }