{ "info": { "author": "Ocean S.A.", "author_email": "osf@ocean.io", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "aiohttp_flashbag\n================\n\nThe library provides flashbag for `aiohttp.web`__.\n\n.. _aiohttp_web: https://docs.aiohttp.org/en/stable/\n\n__ aiohttp_web_\n\n.. image:: https://img.shields.io/travis/aio-libs/aiohttp-flashbag.svg\n :target: https://travis-ci.org/aio-libs/aiohttp-flashbag\n\n.. image:: https://codecov.io/github/aio-libs/aiohttp-flashbag/coverage.svg\n :target: https://codecov.io/github/aio-libs/aiohttp-flashbag\n\nUsage\n-----\n\nThe library allows us to share some data between requests inside session.\n\nBasic usage example:\n\n.. code-block:: python\n\n import aiohttp_flashbag\n from aiohttp import web\n from aiohttp_session import setup as setup_session\n from aiohttp_session import SimpleCookieStorage\n\n\n async def handler_get(request):\n validation_error = aiohttp_flashbag.flashbag_get(request, 'error')\n\n error_html = ''\n\n if validation_error is not None:\n error_html = '{validation_error}'.format(\n validation_error=validation_error,\n )\n\n body = '''\n \n aiohttp_flashbag demo\n \n
\n \n {error_html}\n \n
\n \n \n '''\n body = body.format(error_html=error_html)\n\n return web.Response(body=body.encode('utf-8'), content_type='text/html')\n\n\n async def handler_post(request):\n post = await request.post()\n\n if len(post['name']) == 0:\n aiohttp_flashbag.flashbag_set(request, 'error', 'Name is required')\n\n return web.HTTPSeeOther('/')\n\n body = 'Hello, {name}'.format(name=post['name'])\n\n return web.Response(body=body.encode('utf-8'), content_type='text/html')\n\n\n def make_app():\n session_storage = SimpleCookieStorage()\n\n app = web.Application()\n\n setup_session(app, session_storage)\n\n app.middlewares.append(aiohttp_flashbag.flashbag_middleware)\n\n app.router.add_route(\n 'GET',\n '/',\n handler_get,\n )\n\n app.router.add_route(\n 'POST',\n '/',\n handler_post,\n )\n\n return app\n\n\n web.run_app(make_app())\n\n\n\n\nFirst of all, you have to register ``aiohttp_flashbag.flashbag_middleware`` in ``aiohttp.web.Application``.\n\nYou can get some data from the previous request with ``aiohttp_flashbag.flashbag_get`` method. Parameters:\n\n- **request**. Instance of ``aiohttp.web_request.Request``.\n- **key**. Name of \"variable\" that you want to get\n- **default**. The default value that should be returned, if the key doesn't exist in session flashbag.\n\nTo set one \"variable\" in flashbag you should use ``aiohttp_flashbag.flashbag_set``. Parameters:\n\n- **request**. Instance of ``aiohttp.web_request.Request``.\n- **key**. Name of \"variable\" that you want to specify.\n- **value**. Data that you want to specify.\n\nIf you need to replace all \"variables\" in flashbag you should use ``aiohttp_flashbag.flashbag_replace_all``. Parameters:\n\n- **request**. Instance of ``aiohttp.web_request.Request``.\n- **value**. Dict with values that you want to add into flashbag.\n\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/wikibusiness/aiohttp-flashbag", "keywords": "flashbag,flash messages,aiohttp", "license": "", "maintainer": "", "maintainer_email": "", "name": "aiohttp-flashbag", "package_url": "https://pypi.org/project/aiohttp-flashbag/", "platform": "", "project_url": "https://pypi.org/project/aiohttp-flashbag/", "project_urls": { "Homepage": "https://github.com/wikibusiness/aiohttp-flashbag" }, "release_url": "https://pypi.org/project/aiohttp-flashbag/0.0.3/", "requires_dist": [ "aiohttp (>=2.3.0)", "aiohttp-session (>=1.2.0)" ], "requires_python": "", "summary": "Flashbag (flash messages) support for aiohttp.web", "version": "0.0.3" }, "last_serial": 3860550, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "aa159513a26b7db7428c33a7fc56e4a2", "sha256": "12ab45e6c3ba2e42a6f4852824b8a4eaa49de02a3419cbc56591016ca3273a13" }, "downloads": -1, "filename": "aiohttp_flashbag-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "aa159513a26b7db7428c33a7fc56e4a2", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5241, "upload_time": "2017-11-29T10:57:43", "url": "https://files.pythonhosted.org/packages/94/07/fb675c18adc23f56d3bdf558061da213465e72db244429cf7d8149756ff4/aiohttp_flashbag-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "47f5812223d512c5cb8ab3748c91c9c9", "sha256": "bb1dd229dbc70ce4797816e0f78bbedda488736378ba7dac5f61bf0b029fa1f4" }, "downloads": -1, "filename": "aiohttp-flashbag-0.0.1.tar.gz", "has_sig": false, "md5_digest": "47f5812223d512c5cb8ab3748c91c9c9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3375, "upload_time": "2017-11-29T10:57:45", "url": "https://files.pythonhosted.org/packages/de/ef/6460f376de42b9c7cb672c83bdae273136b8fe6050aa846e66a053825a6c/aiohttp-flashbag-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "1ae724ecfcc469a3aa109ce1bc28fb2f", "sha256": "2d977c4fdf08bc8cd663fc9f739f70ad7fff7d880c75d8ef8f47a3962464c2eb" }, "downloads": -1, "filename": "aiohttp_flashbag-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "1ae724ecfcc469a3aa109ce1bc28fb2f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5239, "upload_time": "2017-11-29T12:19:39", "url": "https://files.pythonhosted.org/packages/96/b5/280a4030724b0a0e8586a1a78670537dccf6c7c901e1dbdfaad5fad7a20c/aiohttp_flashbag-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d2653d4450b147f13c9c285c822db1c9", "sha256": "602c38592bcf0f3ff1b3ee8ba5d08055e664fde7e81de9f83ae7c8259af55d3b" }, "downloads": -1, "filename": "aiohttp-flashbag-0.0.2.tar.gz", "has_sig": false, "md5_digest": "d2653d4450b147f13c9c285c822db1c9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3373, "upload_time": "2017-11-29T12:19:40", "url": "https://files.pythonhosted.org/packages/d0/24/5bf67112717501f4b2afe86c32782d28facd593eee922585e52551c7f227/aiohttp-flashbag-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "7ef949dda3017c9125deb8a0c7c83e88", "sha256": "4a0ac74e859544b9457deb07722c700f29f908234f8b139adf31c0194c7624d6" }, "downloads": -1, "filename": "aiohttp_flashbag-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "7ef949dda3017c9125deb8a0c7c83e88", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3134, "upload_time": "2018-05-14T11:12:03", "url": "https://files.pythonhosted.org/packages/64/45/8765ca000df5e9c76f1d81510c92be3126e0a28e0bdec73ed9b6a342d983/aiohttp_flashbag-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3fa6dbb15bbc30dafc32a8de71a4871c", "sha256": "5b3e2fe5bd1576ca7311baa9b3da2e6d4692b583878d5e397697b7297e296a2d" }, "downloads": -1, "filename": "aiohttp-flashbag-0.0.3.tar.gz", "has_sig": false, "md5_digest": "3fa6dbb15bbc30dafc32a8de71a4871c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3382, "upload_time": "2018-05-14T11:12:05", "url": "https://files.pythonhosted.org/packages/c0/30/1fa93af0a7424f647551e712bd805820e9da26332df7a4a4a2cacffc75d9/aiohttp-flashbag-0.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7ef949dda3017c9125deb8a0c7c83e88", "sha256": "4a0ac74e859544b9457deb07722c700f29f908234f8b139adf31c0194c7624d6" }, "downloads": -1, "filename": "aiohttp_flashbag-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "7ef949dda3017c9125deb8a0c7c83e88", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3134, "upload_time": "2018-05-14T11:12:03", "url": "https://files.pythonhosted.org/packages/64/45/8765ca000df5e9c76f1d81510c92be3126e0a28e0bdec73ed9b6a342d983/aiohttp_flashbag-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3fa6dbb15bbc30dafc32a8de71a4871c", "sha256": "5b3e2fe5bd1576ca7311baa9b3da2e6d4692b583878d5e397697b7297e296a2d" }, "downloads": -1, "filename": "aiohttp-flashbag-0.0.3.tar.gz", "has_sig": false, "md5_digest": "3fa6dbb15bbc30dafc32a8de71a4871c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3382, "upload_time": "2018-05-14T11:12:05", "url": "https://files.pythonhosted.org/packages/c0/30/1fa93af0a7424f647551e712bd805820e9da26332df7a4a4a2cacffc75d9/aiohttp-flashbag-0.0.3.tar.gz" } ] }