buvar_aiohttp
=============
Solves some boilerplate around starting an `aiohttp`_ server.
.. code-block:: python
import aiohttp.web
from buvar import context, di, fork, plugin
from buvar_aiohttp import AioHttpConfig
async def hello(request):
return aiohttp.web.Response(body=b"Hello, world")
async def prepare_aiohttp(load: plugin.Loader):
# provide config
context.add(AioHttpConfig(host="0.0.0.0", port=5678))
# prepare server site
await load("buvar_aiohttp")
# mount routes
app = await di.nject(aiohttp.web.Application)
app.router.add_route("GET", "/", hello)
# start a process for each available CPU and provide a shared socket to all
# children
fork.stage(prepare_aiohttp, forks=0, sockets=["tcp://:5678"])
.. _aiohttp: https://docs.aiohttp.org
Raw data
{
"_id": null,
"home_page": "https://gitlab.com/diefans/buvar",
"name": "buvar-aiohttp",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "Oliver Berger",
"author_email": "diefans@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/c0/be/8ecfbaf5e3f316d4458159f8e8f18dd94d1b7cd4dfe502a351f795efa681/buvar_aiohttp-0.4.5.tar.gz",
"platform": null,
"description": "buvar_aiohttp\n=============\n\nSolves some boilerplate around starting an `aiohttp`_ server.\n\n.. code-block:: python\n\n import aiohttp.web\n from buvar import context, di, fork, plugin\n\n from buvar_aiohttp import AioHttpConfig\n\n\n async def hello(request):\n return aiohttp.web.Response(body=b\"Hello, world\")\n\n\n async def prepare_aiohttp(load: plugin.Loader):\n # provide config\n context.add(AioHttpConfig(host=\"0.0.0.0\", port=5678))\n\n # prepare server site\n await load(\"buvar_aiohttp\")\n\n # mount routes\n app = await di.nject(aiohttp.web.Application)\n app.router.add_route(\"GET\", \"/\", hello)\n\n\n # start a process for each available CPU and provide a shared socket to all\n # children\n fork.stage(prepare_aiohttp, forks=0, sockets=[\"tcp://:5678\"])\n\n\n.. _aiohttp: https://docs.aiohttp.org\n",
"bugtrack_url": null,
"license": "",
"summary": "aiohttp plugin for buvar",
"version": "0.4.5",
"project_urls": {
"Homepage": "https://gitlab.com/diefans/buvar"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "eda0935b7977974dc8ce176a53015388d5de95a900b351396db757668540bcdc",
"md5": "13551a162c5373d0733a924a3f49d091",
"sha256": "99a36c0dba91440eab09b7dfb2ed7b59313b1d6d2348beb349100c79e782208c"
},
"downloads": -1,
"filename": "buvar_aiohttp-0.4.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "13551a162c5373d0733a924a3f49d091",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7,<4.0",
"size": 10609,
"upload_time": "2024-03-18T15:38:08",
"upload_time_iso_8601": "2024-03-18T15:38:08.699878Z",
"url": "https://files.pythonhosted.org/packages/ed/a0/935b7977974dc8ce176a53015388d5de95a900b351396db757668540bcdc/buvar_aiohttp-0.4.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c0be8ecfbaf5e3f316d4458159f8e8f18dd94d1b7cd4dfe502a351f795efa681",
"md5": "02595ce536d9ec7d528b451397803009",
"sha256": "b6bbc2c2084490a4ef1878e7681a75711206b7f4573a6a99703e1db1625c633b"
},
"downloads": -1,
"filename": "buvar_aiohttp-0.4.5.tar.gz",
"has_sig": false,
"md5_digest": "02595ce536d9ec7d528b451397803009",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7,<4.0",
"size": 10628,
"upload_time": "2024-03-18T15:38:10",
"upload_time_iso_8601": "2024-03-18T15:38:10.728590Z",
"url": "https://files.pythonhosted.org/packages/c0/be/8ecfbaf5e3f316d4458159f8e8f18dd94d1b7cd4dfe502a351f795efa681/buvar_aiohttp-0.4.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-18 15:38:10",
"github": false,
"gitlab": true,
"bitbucket": false,
"codeberg": false,
"gitlab_user": "diefans",
"gitlab_project": "buvar",
"lcname": "buvar-aiohttp"
}