Ejemplo n.º 1
0
 def setUp(self):
     self.runner = backend.Runner()
Ejemplo n.º 2
0
Archivo: app.py Proyecto: 4poc/rccvm
import flask
from flask import request, jsonify
from werkzeug.exceptions import default_exceptions
from werkzeug.exceptions import HTTPException
import json
import backend

# discovers and import backends
backend.load()

runner = backend.Runner()

app = flask.Flask(__name__)


def make_json_error(ex):
    response = jsonify(error=type(ex).__name__, message=str(ex))
    response.status_code = (ex.code if isinstance(ex, HTTPException) else 500)
    return response


for code in default_exceptions.iterkeys():
    app.error_handler_spec[None][code] = make_json_error


# Lists all available backends.
@app.route('/backends')
def list_backends():
    return jsonify(
        **{
            'backends': [{