Esempio n. 1
0
def create_app(settings_override=None):
    """Returns the REST API application instance."""
    app = create_app_factory(__name__, __path__, settings_override)
    app.errorhandler(OcdApiError)(OcdApiError.serialize_error)

    def add_cors_headers(resp):
        resp.headers['Access-Control-Allow-Origin'] = '*'
        return resp

    app.after_request(add_cors_headers)

    return app
Esempio n. 2
0
def create_app(settings_override=None):
    """Returns the REST API application instance."""
    app = create_app_factory(__name__, __path__, settings_override)
    app.errorhandler(OcdApiError)(OcdApiError.serialize_error)

    def add_cors_headers(resp):
        resp.headers['Access-Control-Allow-Origin'] = '*'
        return resp

    app.after_request(add_cors_headers)

    return app
Esempio n. 3
0
def create_app(settings_override=None):
    """Returns the REST API application instance."""
    app = create_app_factory(__name__, __path__, settings_override)
    app.errorhandler(OcdApiError)(OcdApiError.serialize_error)

    def add_cors_headers(resp):
        resp.headers['Access-Control-Allow-Origin'] = '*'
        # See https://stackoverflow.com/questions/12630231/how-do-cors-and-access-control-allow-headers-work
        resp.headers['Access-Control-Allow-Headers'] = 'origin, content-type, accept'
        return resp

    app.after_request(add_cors_headers)

    return app
Esempio n. 4
0
def create_app(settings_override=None):
    """Returns the REST API application instance."""
    app = create_app_factory(__name__, __path__, settings_override)
    app.errorhandler(OcdApiError)(OcdApiError.serialize_error)
    app.es = ElasticsearchService(app.config['ELASTICSEARCH_HOST'],
                                  app.config['ELASTICSEARCH_PORT'])

    def add_cors_headers(resp):
        resp.headers['Access-Control-Allow-Origin'] = '*'
        return resp

    app.after_request(add_cors_headers)

    return app
Esempio n. 5
0
def create_app(settings_override=None):
    """Returns the REST API application instance."""
    app = create_app_factory(__name__, __path__, settings_override)
    app.errorhandler(OcdApiError)(OcdApiError.serialize_error)
    app.es = ElasticsearchService(app.config['ELASTICSEARCH_HOST'],
                                  app.config['ELASTICSEARCH_PORT'])

    def add_cors_headers(resp):
        resp.headers['Access-Control-Allow-Origin'] = '*'
        return resp

    app.after_request(add_cors_headers)

    return app
Esempio n. 6
0
def create_app(settings_override=None):
    """Returns the REST API application instance."""
    app = create_app_factory(__name__, __path__, settings_override)
    app.errorhandler(OcdApiError)(OcdApiError.serialize_error)

    def add_cors_headers(resp):
        resp.headers['Access-Control-Allow-Origin'] = '*'
        # See https://stackoverflow.com/questions/12630231/how-do-cors-and-access-control-allow-headers-work
        resp.headers['Access-Control-Allow-Headers'] = 'origin, content-type, accept'
        return resp

    app.after_request(add_cors_headers)
    put_alerts_template(app.es)
    put_mapping_template(app.es, 'ori_usage_logs')
    put_mapping_template(app.es, 'wo_user_feedback')
    sys.stdout.flush()

    return app