Skip to main content

Flask Zookeeper client

Project description

[![Build Status](https://travis-ci.org/cdumay/flask-zookeeper.svg?branch=master)](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 Flask-Zookeeper 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:

```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.2.tar.gz (3.5 kB view details)

Uploaded Source

Built Distributions

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

Uploaded Python 3

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

Uploaded Python 2

File details

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

File metadata

File hashes

Hashes for flask-zookeeper-0.0.2.tar.gz
Algorithm Hash digest
SHA256 53347b7f089d1f53a975038a825170099292f0d39b317afa1714fcc3aaa6bb16
MD5 00a23192ef19adf545f01abd3cb208c8
BLAKE2b-256 6b84835d0159bcbf8fafc1eccd4f4617c6b455e959e36e9f8bfd8fb6ccd48231

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for flask_zookeeper-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 24bdbd928ef1da1809b9121883b7deecff8f68a4b22aa979b6ce28ebd0646948
MD5 1e57e9e1401eba4af7522510204a4070
BLAKE2b-256 79f5562398556a4e0e10908d6ae6d9af62cb8979c10f4e6618fc9d1260fc46be

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for flask_zookeeper-0.0.2-py2-none-any.whl
Algorithm Hash digest
SHA256 f6ff26626bc462d59c56b41ce7616e9a00e7cb381a94cb59bd8014bccd820eee
MD5 5112a94e3f63f6a362cc187744e7a695
BLAKE2b-256 83533f9e9c15b5517e7d7c9808b4e2b5ece1f9f85a5ddc75cd21f723d8432b4d

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