Skip to main content

Asyncio 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


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.3.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

buvar_aiohttp-0.4.3-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file buvar_aiohttp-0.4.3.tar.gz.

File metadata

  • Download URL: buvar_aiohttp-0.4.3.tar.gz
  • Upload date:
  • Size: 4.9 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

Hashes for buvar_aiohttp-0.4.3.tar.gz
Algorithm Hash digest
SHA256 a3cebdc53d655c31cf28b05e74770373e0bf918be95292fc7294eb7fbcb9bc43
MD5 dc6ca7999c49852e3e57411be2362225
BLAKE2b-256 4f376534acea30fbe47922ca21958842e0fc14e589c980c6bb7081d31ee5f912

See more details on using hashes here.

File details

Details for the file buvar_aiohttp-0.4.3-py3-none-any.whl.

File metadata

  • Download URL: buvar_aiohttp-0.4.3-py3-none-any.whl
  • Upload date:
  • Size: 7.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

Hashes for buvar_aiohttp-0.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 35ac63516e14eeaed0f04d879befb013d50b7725601b015bfa5a8413a4b1409a
MD5 d9ea8a6c275c3f1f93d054c1c48f678c
BLAKE2b-256 3af7c83a32873dac49029e368184b8a07691cdb9d6ea84f836e01edcad8fcc93

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page