API Docs

Flask application factories

Flask application factories for Invenio flavours.

invenio_app.factory.app_class()[source]

Create Flask application class.

Invenio-Files-REST needs to patch the Werkzeug form parsing in order to support streaming large file uploads. This is done by subclassing the Flask application class.

invenio_app.factory.config_loader(app, **kwargs_config)[source]

Configuration loader.

invenio_app.factory.create_api(**kwargs)

Flask application factory for Invenio REST API.

invenio_app.factory.create_app(**kwargs)

Flask application factory for combined UI + REST API.

REST API is mounted under /api.

invenio_app.factory.create_ui(**kwargs)

Flask application factory for Invenio UI.

invenio_app.factory.instance_path()[source]

Instance path for Invenio.

Defaults to <env_prefix>_INSTANCE_PATH
or if environment variable is not set <sys.prefix>/var/instance.
invenio_app.factory.static_folder()[source]

Static folder path.

Defaults to <env_prefix>_STATIC_FOLDER or if environment variable is not set <sys.prefix>/var/instance/static.

invenio_app.factory.static_url_path()[source]

Static url path.

Defaults to <env_prefix>_STATIC_URL_PATH or if environment variable is not set /static.

WSGI applications

UI + REST WSGI application for Invenio flavours.

invenio_app.wsgi.application = <Flask 'invenio'>

Combined UI + REST Flask application.

REST API is mounted under /api.

REST-only WSGI application for Invenio flavours.

invenio_app.wsgi_rest.application = <Flask 'invenio'>

WSGI application for Invenio REST API.

UI-only WSGI application for Invenio flavours.

invenio_app.wsgi_ui.application = <Flask 'invenio'>

WSGI application for Invenio UI.

Celery application factory

Celery application for Invenio flavours.

invenio_app.celery.celery = <Celery default>

Celery application for Invenio.

Overrides SENTRY_TRANSPORT wih synchronous HTTP transport since Celery does not deal nicely with the default threaded transport.

CLI application factory

CLI application for Invenio flavours.

invenio_app.cli.cli = <FlaskGroup cli>

Invenio CLI application.

Flask limiter functions

Flask Limiter functions.

invenio_app.limiter.set_rate_limit()[source]

Set rates for Flask limiter.

Returns:a rate limit string with the Flask-Limiter format.

For more information regarding the format you can see here.

The order in which the rate will be evaluated is the following:

1)Initially the endpoint is going to be evaluated against the whitelisted ones. If it has been marked as whitelisted then the custom limit for this endpoint will be the one to be returned.

2)If the endpoint is not whitelisted and the flask-security package is installed, it will evaluate if the user is logged in and if this is the case it will also check if there is an explicitly defined rate limit for them by comparing theire ID with the ones present in the `RATELIMIT_PER_USER` mapping. If it is present then the custom rate limit value will be returned, otherwise the one returned will be the `RATELIMIT_AUTHENTICATED_USER`

3)Finally if none of the above is our case then the `RATELIMIT_GUEST_USER` will be the one to be returned.

invenio_app.limiter.useragent_and_ip_limit_key()[source]

Create key for the rate limiting.