Skip to main content

Flask extension for unleash-client-python.

Project description


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.


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


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 ( for more complex features.
context = {
    'userId': ''
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

The following configuration values exist for Flask-Unleash.

Config Description Required? Type Default Value
UNLEASH_URL Unleash server URL Y String N/A
UNLEASH_APP_NAME Name of your program Y String N/A
UNLEASH_ENVIRONMENT Environment of your service Y String N/A
UNLEASH_INSTANCE_ID Unique ID for your program N String unleash-client-python
UNLEASH_REFRESH_INTERVAL How often the unleash client should check for configuration changes. N Integer 15
UNLEASH_METRIC_INTERVAL How often the unleash client should send metrics to server. N Integer 60
UNLEASH_DISABLE_METRICS Disables sending metrics to Unleash server. N Boolean F
UNLEASH_DISABLE_REGISTRATION Disables registration with Unleash server. N Boolean F
UNLEASH_CUSTOM_HEADERS Custom headers to send to Unleash. N Dictionary {}
UNLEASH_CUSTOM_OPTIONS Custom arguments for requests package. N Dictionary {}
UNLEASH_CUSTOM_STRATEGIES Custom strategies you'd like UnleashClient to support. N Dictionary {}
UNLEASH_CACHE_DIRECTORY Location of the cache directory. When unset, FCache will determine the location N Str Unset

Project details

Download files

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

Files for flask-unleash, version 1.0.4
Filename, size File type Python version Upload date Hashes
Filename, size flask_unleash-1.0.4-py3-none-any.whl (8.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size flask_unleash-1.0.4.tar.gz (5.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page