Skip to main content

aiohttp.web OpenAPI 3 schema first server applications.

Project description

CI Workflow pre-commit black Latest Version Python versions BSD License Coverage Documentation

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.

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 typing import List

from aiohttp import web
from rororo import (

operations = OperationTableDef()

async def hello_world(request: web.Request) -> web.Response:
    with openapi_context(request) as context:
        name = context.parameters.query.get("name", "world")
        return web.json_response({"message": f"Hello, {name}!"})

def create_app(argv: List[str] = None) -> web.Application:
    return setup_openapi(
        Path(__file__).parent / "openapi.yaml",

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,

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.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for rororo, version 2.2.2
Filename, size File type Python version Upload date Hashes
Filename, size rororo-2.2.2-py3-none-any.whl (42.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size rororo-2.2.2.tar.gz (37.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page