Session Management Middleware

class falcon_sqla.middleware.Middleware(manager)

Falcon middleware that can be used with the session manager.

Parameters:

manager (Manager) – Manager instance to use in this middleware.

process_request(req, resp)

Set up a SQLAlchemy session for this request.

The session object is stored as req.context.session.

When the sticky_binds option is set to True, a req.context.request_id identifier is created (if not already present) by calling the request_id_func function.

process_response(req, resp, resource, req_succeeded)

Clean up the session, if one was provided.

This response hook finalizes the session by calling the manager’s close_session() method.