Skip to main content

Flask Zookeeper client

Project description

.. image:: https://travis-ci.org/cdumay/flask-zookeeper.svg?branch=master
:target: https://travis-ci.org/cdumay/flask-zookeeper

Flask-Zookeeper
===============

The Flask-Zookeeper extension provides support to
`Zookeeper <http://zookeeper.apache.org/>`_ clusters.

Quickstart
----------

First, install cdumay-rest-client using
`pip <https://pip.pypa.io/en/stable/>`_:

$ pip install flask-zookeeper

Flask-Zookeeper depends, and will install for you, recent versions of
Flask and [Kazzo](https://kazoo.readthedocs.io/en/latest/).
Flask-Zookeeper is compatible with and tested on Python 2.7, 3.4 and 3.5.

Next, add a `FlaskZookeeperClient` instance to your code:

.. code-block:: python

from flask import Flask
from flask_zookeeper import FlaskZookeeperClient

app = Flask(__name__)

fzc = FlaskZookeeperClient(app)

You can take a look at `tests/test_base.py <tests/test_base.py>`_ for more
complete example.

You can also take a look at
`tests/test_blueprint.py <tests/test_blueprint.py>`_ for an example using Flask's
`application factories <http://flask.pocoo.org/docs/patterns/appfactories/>`_
and `blueprints <http://flask.pocoo.org/docs/blueprints/>`_.

About setting up
----------------

Flask-Zookeeper uses additional variables which can be set in the
`app.config`:

Main values
***********

* **KAZOO_HOSTS**: Zookeeper quorum server list separated by commas (
default: `127.0.0.1:2181`).
* **KAZOO_START_TIMEOUT**: Time in seconds to wait for connection to
succeed (default: `15`).
* **KAZOO_SESSION_TIMEOUT**: The longest to wait for a Zookeeper
connection (default: `10.0`).
* **KAZOO_RETRY**: Dict of options to use for retrying the connection
to Zookeeper (default: `{'max_delay': 3600}`).

ACL configuration
*****************

Zookeeper allow to set ACL. To enable this feature, set
`KAZOO_ACL_USERNAME` and `KAZOO_ACL_PASSWORD` in the `app.config`.

* **KAZOO_ACL_USERNAME**: Username to use for the ACL.
* **KAZOO_ACL_PASSWORD**: A plain-text password to hash.
* **KAZOO_ACL_READ**: Read permission (default: `False`).
* **KAZOO_ACL_WRITE**: Write permission (default: `False`).
* **KAZOO_ACL_CREATE**: Create permission (default: `False`).
* **KAZOO_ACL_DELETE**: Delete permission (default: `False`).
* **KAZOO_ACL_ADMIN**: Admin permission (default: `False`).
* **KAZOO_ACL_ALL**: All permissions (default: `False`).

You can take a look at `tests/test_acl.py <tests/test_acl.py`_ for a
complete example.

License
-------

Apache License 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flask-zookeeper-0.0.4.tar.gz (3.5 kB view details)

Uploaded Source

Built Distributions

flask_zookeeper-0.0.4-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

flask_zookeeper-0.0.4-py2-none-any.whl (5.7 kB view details)

Uploaded Python 2

File details

Details for the file flask-zookeeper-0.0.4.tar.gz.

File metadata

File hashes

Hashes for flask-zookeeper-0.0.4.tar.gz
Algorithm Hash digest
SHA256 f70afdb8d60c8a2184f25d003d767d23f873fe3d2a428347693c7cbe3b82f1d7
MD5 8e065f8fe413663c23973db9a4be1208
BLAKE2b-256 cdd8eb2f54a1b1c743faf61a7d665d2082e0fa07535323d3792ffdc40a893b3d

See more details on using hashes here.

File details

Details for the file flask_zookeeper-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for flask_zookeeper-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9d7133d0d8e50e8d6a10227cf108f9c28f661284a89fb3dc6eeb446c7b49fbc8
MD5 d0f8a063908c6eabc21044ea96f95fca
BLAKE2b-256 42e6222b9f695fbdb3516489551b99dce3e25882498fc62c3a4b96d1f886cb03

See more details on using hashes here.

File details

Details for the file flask_zookeeper-0.0.4-py2-none-any.whl.

File metadata

File hashes

Hashes for flask_zookeeper-0.0.4-py2-none-any.whl
Algorithm Hash digest
SHA256 363e9fc21b2341ec2faa6f6c7d4adb376ad8cd0ca6358890c83c42495cd6c7a4
MD5 812ae474384178cbe320cef4ce5316d2
BLAKE2b-256 59a0d8501371ca026c183e97b49d0e97775b2caf4ecb50ff899a1f0bce45ee52

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page