aiohttp plugin for buvar
Project description
Solves some boilerplate around starting an aiohttp server.
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"])
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
buvar_aiohttp-0.4.4.tar.gz
(5.0 kB
view details)
Built Distribution
File details
Details for the file buvar_aiohttp-0.4.4.tar.gz
.
File metadata
- Download URL: buvar_aiohttp-0.4.4.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f303d9d078c2f287e875790efc482a0c21c56faebb4675c9a280e63ccc5221e |
|
MD5 | 0f1915c70d8f001ae10bf940d7fc94d2 |
|
BLAKE2b-256 | d1a08bc2f27a539d13e66ad74e6ef3a6fa7f04d0a52a986055ead14344356d07 |
File details
Details for the file buvar_aiohttp-0.4.4-py3-none-any.whl
.
File metadata
- Download URL: buvar_aiohttp-0.4.4-py3-none-any.whl
- Upload date:
- Size: 12.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec9825cc0eaa5716ee9d76333e85191ca4d053ed75afe6f159533f5aacd89e88 |
|
MD5 | c17abb058d0c1d36a96aa0df95b468be |
|
BLAKE2b-256 | ba95d86f2ac979746a630dbe086ebb4d114fd5402d11cf186677295f12e31386 |