Skip to main content

Session flash messages for aiohttp.web

Project description


The library provides flash messages for aiohttp.web on top of aiohttp_session.

“Flash messages” are simply a queue of string messages (or other JSON-serializable objects) stored in the session.


pip install aiohttp_session_flash


Add session_middleware and aiohttp_session_flash.middleware to the list of app’s middleware:

app = web.Application(

Within the handler, pull and push flash messages as needed:

from aiohttp import web

from aiohttp_session_flash import flash, pop_flash

async def foo(request):
        flash(request, "Hello")
        flash(request, ["This", "works", "too"])
        return web.Response(body=b'Flashed some messages')

async def bar(request):
        for message in pop_flash(request):
        return web.Response(body=b'OK')

Template context processor

The template context processor is provided for template libraries that can use it:

aiohttp_mako_context_processors.setup(app, [
% for message in get_flashed_messages():
% endfor


Running tests

pip install -r requirements_test.txt

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for aiohttp_session_flash, version 0.0.4
Filename, size File type Python version Upload date Hashes
Filename, size aiohttp_session_flash-0.0.4.tar.gz (2.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page