Skip to main content

OpenAPI 3 schema support for aiohttp.web applications.

Project description

CircleCI Latest Version Python versions BSD License Coverage Documentation

OpenAPI 3 schema support for aiohttp.web applications.

As well as bunch other utilities to build effective web applications with Python 3 & aiohttp.web.

  • Works on Python 3.6+

  • BSD licensed

  • Source, issues, and pull requests on GitHub

Quick Start

rororo relies on valid OpenAPI 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")
        return web.json_response({"message": f"Hello, {name}!"})


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

Check examples folder to see other examples on how to use OpenAPI 3 schemas with aiohttp.web applications.

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

rororo-2.0.0a1.tar.gz (19.1 kB view details)

Uploaded Source

Built Distribution

rororo-2.0.0a1-py3-none-any.whl (22.9 kB view details)

Uploaded Python 3

File details

Details for the file rororo-2.0.0a1.tar.gz.

File metadata

  • Download URL: rororo-2.0.0a1.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.17 CPython/3.7.4 Linux/4.15.0-1043-aws

File hashes

Hashes for rororo-2.0.0a1.tar.gz
Algorithm Hash digest
SHA256 328c2b14e88e3dd8998ea78f9fa44eb3339791d9cf4ef05406eea4e6c24e9fc4
MD5 c7b281b04cfb60ca8e67cfc65800c4a5
BLAKE2b-256 971927c839aea63c75206f3aea8e4c638c554918b3413c80766afc920256be47

See more details on using hashes here.

Provenance

File details

Details for the file rororo-2.0.0a1-py3-none-any.whl.

File metadata

  • Download URL: rororo-2.0.0a1-py3-none-any.whl
  • Upload date:
  • Size: 22.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.17 CPython/3.7.4 Linux/4.15.0-1043-aws

File hashes

Hashes for rororo-2.0.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 d7063e8c0c483660e2933333372d14fe82628fe0661b99811666471c9a31f55d
MD5 46226e4dbcc579d00bb90e40ff817a7d
BLAKE2b-256 21e8c0a68797e56cc384bce4c2238dcc17f5b690293a7b783f91431d4a6b45be

See more details on using hashes here.

Provenance

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