Skip to main content

aiohttp-asgi

PyPI - License Wheel PyPI PyPI Coverage Status tests

This module provides a way to use any ASGI compatible frameworks and aiohttp together.

Example

from aiohttp import web
from fastapi import FastAPI
from starlette.requests import Request as ASGIRequest

from aiohttp_asgi import ASGIResource


asgi_app = FastAPI()


@asgi_app.get("/asgi")
async def root(request: ASGIRequest):
    return {
        "message": "Hello World",
        "root_path": request.scope.get("root_path")
    }


aiohttp_app = web.Application()

# Create ASGIResource which handle
# any request startswith "/asgi"
asgi_resource = ASGIResource(asgi_app, root_path="/asgi")

# Register resource
aiohttp_app.router.register_resource(asgi_resource)

# Mount startup and shutdown events from aiohttp to ASGI app
asgi_resource.lifespan_mount(aiohttp_app)

# Start the application
web.run_app(aiohttp_app)

Installation

pip install aiohttp-asgi

ASGI HTTP server

Command line tool for starting aiohttp web server with ASGI app.

Example

Create the test_app.py

from starlette.applications import Starlette
from starlette.responses import JSONResponse
from starlette.routing import Route


async def homepage(request):
    return JSONResponse({'hello': 'world'})

routes = [
    Route("/", endpoint=homepage)
]

application = Starlette(debug=True, routes=routes)

and run the test_app.py with aiohttp-asgi

aiohttp-asgi \
    --address "[::1]" \
    --port 8080 \
    test_app:application

alternatively using python -m

python -m aiohttp_asgi \
    --address "[::1]" \
    --port 8080 \
    test_app:application

Metadata

Release files for aiohttp-asgi 0.6.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-asgi 0.6.0
File Size Uploaded Provenance
aiohttp_asgi-0.6.0.tar.gz 10.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for aiohttp-asgi 0.6.0
File Interpreter ABI Platform
aiohttp_asgi-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 26.7 kB

Release files / aiohttp_asgi-0.6.0.tar.gz

Download URL aiohttp_asgi-0.6.0.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
798f685013ba77e3e0a954a28b2f404900b674f1725217c165abcdfaa09a740c
BLAKE2b-256 checksum
How to use checksums
0498c9ed329328b39f0beb74d207e8aaeb047e44c63028ab82e9ad82666543a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.13.2 Darwin/24.4.0

Release files / aiohttp_asgi-0.6.0-py3-none-any.whl

Download URL aiohttp_asgi-0.6.0-py3-none-any.whl
Size 15.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0af9cd08daff1155ba0e8f5e4580efd7b38707903cf6802c2e5df22df04da159
BLAKE2b-256 checksum
How to use checksums
2459b9acae33dc024eb7545ed7b795e4f3883bbce23c93f65d27d992eaba59ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.13.2 Darwin/24.4.0

Security for aiohttp-asgi 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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