Skip to main content

Flask extension for unleash-client-python.

Project description

Flask-Unleash

Coverage Status PyPI version PyPI - Python Version License: MIT

Flask extension to make using Unleash that much easier! 🚦🚦🚦 This plugin makes integrating the Python Unleash client into quick and easy.

Pre-requisites

To try out Flask-Unleash, you'll need an instance of the Unleash server. You can either use:

Quickstart

Install Flask-Unleash using pip.

pip install Flask-Unleash

Next, add Flask-Unleash to your code.

from flask import Flask
from flask_unleash import Unleash

app = Flask(__name__)
app.config["UNLEASH_URL"] = "http://localhost:4242/api"
app.config["UNLEASH_APP_NAME"] = "demoapp"
unleash = Unleash(app)

Now you can use the client to check feature flags

flag_value_1 = unleash.client.is_enabled("simple-feature")

# You can pass in a context object (https://unleash.github.io/docs/unleash_context) for more complex features.
context = {
    'userId': 'hamster@hamster.com'
}
flag_value_2 = unleash.client.is_enabled("complex-feature", context)

Check out the demo app for a more real-life sample implementation.

Configuring Flask-Unleash

See the Flask-Unleash documentation for information about configuring Unleash.

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_unleash-2.1.0.tar.gz (18.0 kB view hashes)

Uploaded Source

Built Distribution

flask_unleash-2.1.0-py3-none-any.whl (9.3 kB view hashes)

Uploaded Python 3

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