Skip to main content

A chaos engineering framework for Python Flask applications.

Project description

Chaos Middleware Flask integration

CI Python versions

Install

This package requires Python 3.5+

$ pip install -U proofdock-chaos-middleware-flask

Usage

The chaos middleware for Flask takes the following input variables:

Variable Description
CHAOS_MIDDLEWARE_APPLICATION_NAME The service application's name
CHAOS_MIDDLEWARE_APPLICATION_ENV The service application's deployed environment
CHAOS_MIDDLEWARE_PROOFDOCK_API_TOKEN The API token to connect to Proofdock's Chaos API

The configuration exemplified as code:

from flask import Flask, jsonify
from pdchaos.middleware.contrib.flask.flask_middleware import FlaskMiddleware

app = Flask(__name__)
app.config['CHAOS_MIDDLEWARE_APPLICATION_NAME'] = 'example-application-name'
app.config['CHAOS_MIDDLEWARE_APPLICATION_ENV'] = 'example-environment'
app.config['CHAOS_MIDDLEWARE_PROOFDOCK_API_TOKEN'] = 'eyJ0eXAi...05'

middleware = FlaskMiddleware(app)

# Your business logic here

@app.route("/")
def hello():
    return "Hello World!"

if __name__ == "__main__":
    app.run()

References

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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