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

Important

2.0.0 version still in development. To install it use,

pip install rororo>=2.0.0a3

or,

poetry add rororo^=2.0.0a3

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

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.0b1.tar.gz (21.5 kB view details)

Uploaded Source

Built Distribution

rororo-2.0.0b1-py3-none-any.whl (25.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rororo-2.0.0b1.tar.gz
  • Upload date:
  • Size: 21.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.0b4 CPython/3.8.0 Linux/4.15.0-1043-aws

File hashes

Hashes for rororo-2.0.0b1.tar.gz
Algorithm Hash digest
SHA256 5a08f42197977237e6365be14051bfc612aba4c04da20811086eb155ba9f1a30
MD5 669875f4d796bf91c76c4d7ec41c129e
BLAKE2b-256 145d1e2e017702244a4fd8be2b7c8c16625bddd2ed4feb9be9def8de8b372182

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: rororo-2.0.0b1-py3-none-any.whl
  • Upload date:
  • Size: 25.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.0b4 CPython/3.8.0 Linux/4.15.0-1043-aws

File hashes

Hashes for rororo-2.0.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 9dd1f55b268dc6993cf3f149b14b21f5de6a8b829a7368c56506fe6f8cee63b5
MD5 0b6b4941d6100a85c5f770ce708d2a9a
BLAKE2b-256 3ec5369df6ca61f3f264b6fdc8f8902928bcf422e4aab833425a6f7d8789bbb7

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