Implement aiohttp.web OpenAPI 3 server applications with schema first approach.
As well as bunch other utilities to build effective server applications with Python 3 & aiohttp.web.
Works on Python 3.8+
Works with aiohttp.web 3.8.1+
BSD licensed
Source, issues, and pull requests on GitHub
Quick Start
rororo relies on valid OpenAPI 3 schema file (both JSON or YAML formats supported).
Example below, illustrates on how to handle operation hello_world from openapi.yaml schema file.
from pathlib import Path
from aiohttp import web
from rororo import (
openapi_context,
OperationTableDef,
setup_openapi,
)
operations = OperationTableDef()
@operations.register
async def hello_world(request: web.Request) -> web.Response:
with openapi_context(request) as context:
name = context.parameters.query.get("name", "world")
email = context.parameters.query.get(
"email", "world@example.com"
)
return web.json_response(
{"message": f"Hello, {name}!", "email": email}
)
def create_app(argv: list[str] = None) -> web.Application:
return setup_openapi(
web.Application(),
Path(__file__).parent / "openapi.yaml",
operations,
server_url="/api",
)
Schema First Approach
Unlike other popular Python OpenAPI 3 solutions, such as Django REST Framework, FastAPI, flask-apispec, or aiohttp-apispec rororo requires you to provide valid OpenAPI 3 schema first. This makes rororo similar to connexion, pyramid_openapi3 and other schema first libraries.
Class Based Views
rororo supports class based views as well. Todo-Backend example illustrates how to use class based views for OpenAPI 3 servers.
In snippet below, rororo expects that OpenAPI 3 schema contains operation ID UserView.get,
@operations.register
class UserView(web.View):
async def get(self) -> web.Response: ...
More Examples
Check examples folder to see other examples on how to build aiohttp.web OpenAPI 3 server applications.
Metadata
Release files for rororo 3.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| rororo-3.3.0.tar.gz | 38.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rororo-3.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 82.2 kB
Release files / rororo-3.3.0.tar.gz
| Download URL | rororo-3.3.0.tar.gz |
|---|---|
| Size | 38.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5e322dbbde30453989251471f4e37e12e407bb5b6bf0f23c32741bc5a657d54c
|
|
BLAKE2b-256 checksum How to use checksums |
151596a21472eb72e4429dc22548055067ea2fa24b4a71240af6b2b1424834d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.0 CPython/3.12.5
|
Release files / rororo-3.3.0-py3-none-any.whl
| Download URL | rororo-3.3.0-py3-none-any.whl |
|---|---|
| Size | 43.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
94e75d08decf89b44944696aa55ab6037a7c0e9788537dcf506510b698ad5572
|
|
BLAKE2b-256 checksum How to use checksums |
8c30ac7213550d57195c5a23eb08e77c4631de23ac399f3bb66893a82d2e4a28
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.0 CPython/3.12.5
|
Security for rororo 3.3.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.