# Python

Great. You found the right path to reliable applications.

Select the right framework and proceed with that section:

# Flask

Reliability Platform client for Python Flask connects your application with Reliability Platform and lets you inject faults.

You will need a favorite text editor or IDE, and Python 3.5 or later.

# Install

$ pip install -U proofdock-reliability-platform-flask

# Configuration

Configure your application by following the following steps:

  1. Sign in to the Reliability Platform.
  2. Acquire a token in the Tokens view.
  3. Configure the following input variables:
    from flask import Flask, jsonify
    from pdchaos.middleware.contrib.flask.flask_middleware import FlaskMiddleware
    
    app = Flask(__name__)
    app.config['CHAOS_MIDDLEWARE_APPLICATION_NAME'] = 'web-api'          # the application name
    app.config['CHAOS_MIDDLEWARE_APPLICATION_ENV'] = 'qa'                # the environment
    app.config['CHAOS_MIDDLEWARE_PROOFDOCK_API_TOKEN'] = 'eyJ0eXAi...05' # obtain it from Reliability Platform
    
    middleware = FlaskMiddleware(app)
    
    ...
    
    @app.route("/")
    def hello():
        return "Hello World!"
    
    if __name__ == "__main__":
        app.run()
    

# Usage

Injecting faults is easy. Once you configured your application, follow these steps:

  1. Run your application.
  2. Select your application in the Applications view. This step might take up to 30 seconds until your application pops up.
  3. Activate the fault injection button.
  4. Start working on the resiliency.