Skip to main content

Install

pip install aiohttp-runner

Example usage

import asyncio
import aiohttp.web
from async_generator import asynccontextmanager
from aiohttp_runner import (
    simple_http_runner, gunicorn_http_runner,
    HttpRequest, HttpResponse,
    create_http_app, wait_for_interrupt,
)


@asynccontextmanager
async def app_factory():
    yield create_http_app(routes=[
        ('GET', '/', http_handler),
    ])


async def http_handler(_req: HttpRequest) -> HttpResponse:
    return aiohttp.web.Response(status=204)


async def main() -> None:
    bind = '127.0.0.1:8080'

    runner = gunicorn_http_runner(app_factory, bind, workers=2)
    # OR
    runner = simple_http_runner(app_factory, bind)

    async with runner:
        await wait_for_interrupt()


if __name__ == '__main__':
    asyncio.get_event_loop().run_until_complete(main())

Metadata

Release files for aiohttp-runner 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiohttp-runner 0.5.0
File Size Uploaded
aiohttp-runner-0.5.0.tar.gz 5.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aiohttp-runner 0.5.0
File Interpreter ABI Platform
aiohttp_runner-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.0 kB

Release files / aiohttp-runner-0.5.0.tar.gz

Download URL aiohttp-runner-0.5.0.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
06d940bfb9c18002d8bdcffc6ac5eeedb40cab144ed85680f47bc34392928d4a
BLAKE2b-256 checksum
How to use checksums
676c7861ce6c6086da38fdfbdbd8f8f2c4cd582a5d051a70fea9babe6c4bfa2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.3.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

Release files / aiohttp_runner-0.5.0-py3-none-any.whl

Download URL aiohttp_runner-0.5.0-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6be1a0dc6f08a11386b4694661d0471834b2946d7152e2521f189c940a89fe52
BLAKE2b-256 checksum
How to use checksums
1f5e21733476a01129ebb62c7aad4206f6d67339b67a5017d4069700d02c1719
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.3.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page