{ "info": { "author": "Imbolc", "author_email": "imbolc@imbolc.name", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: ISC License (ISCL)", "Programming Language :: Python :: 3" ], "description": "aiohttp_tools\n=============\n\nIt contains:\n\n- ``url_for`` - flask-like url reverser\n- ``jsonify`` - flask-like json-dumper with support of ``datetime``, and ``ObjectId``\n- ``redirect`` - django-like redirect\n- ``get_argument`` - tornado-like util to get GET / POST arguments\n- ``static_url`` - tornado-like url-wrapper to add version hast to static asset\n- ``flash`` - simple flash messages, usage described bellow\n- ``get_client_ip`` - client IP address\n- ``add_trailing_slash`` - middleware for adding trailing slash to unknown url\n- ``fix_host`` - middleware for redirect requests by IP to right domain\n- ``template_handler`` - handler that just render template\n- ``url_for_processor`` - context processor for using ``url_for`` without passing request\n- ``session_processor`` - context_processor for ``aiohttp_session``\n\n\nLook at the `example` folder for working example.\n\n\nInstallation\n------------\n::\n\n pip install aiohttp_tools\n\nRepository: https://github.com/imbolc/aiohttp_tools\n\n\nFlash messages\n--------------\n.. code-block:: python\n\n from aiohttp_tools.flash import flash\n\n # you should include session middleware before flash middleware\n aiohttp_session.setup(app, ...)\n app.middlewares.append(aiohttp_tools.flash.middleware)\n context_processors.append(aiohttp_tools.flash.context_processor)\n\n async def handler(request):\n flash.message(request, 'Message', 'level')\n # shortcuts\n flash.info(request, 'Some message')\n flash.success(...)\n flash.warning(...)\n flash.error(...)\n\n\n.. code-block:: html\n\n {% for message, level in get_flashed_messages() %}\n