Skip to main content

aiohttp-apiset

https://github.com/aamalev/aiohttp_apiset/workflows/Tests/badge.svg Coverage Code style: ruff https://img.shields.io/pypi/v/aiohttp_apiset.svg Documentation Status https://img.shields.io/pypi/dm/aiohttp-apiset.svg Hatch project

Package to build routes and validate request using swagger specification 2.0.

Features

  • Building of the routing from specification swagger

  • Using inclusions other specifications with concatenate url

  • Optional output of the resulting specification and view embed swagger-ui

  • Advanced router with TreeResource

  • Extract specify parameters from request and validate with jsonschema

  • Serialize data as response with middleware

Usecase

Package aiohttp_apiset allows supports several strategies:

  • The foreign specification. When the specification is made and maintained by another team.

  • The specification in the code. When the fragments of specification are placed in the docstrings.

  • Mixed strategy. When routing are located in the specification files and operations are described in the docstrings.

Example

async def handler(request, pet_id):
    """
    ---
    tags: [Pet]
    description: Info about pet
    parameters:
      - name: pet_id
        in: path
        type: integer
        minimum: 0
    responses:
      200:
        description: OK
      400:
        description: Validation error
      404:
        description: Not found
    """
    pet = await db.pets.find(pet_id)

    if not pet:
        return {'status': 404, 'msg': 'Not Found'}

    return {
        'pet': pet,  # dict serialized inside jsonify
    }


def main():
    router = SwaggerRouter(
        swagger_ui='/swagger/',
        version_ui=2,
    )
    router.add_get('/pets/{pet_id}', handler=handler)

    app = web.Application(
        router=router,
        middlewares=[jsonify],
    )

    web.run_app(app)

Is now available in the swagger-ui to the address http://localhost:8080/swagger/. Available both branch swagger-ui. For use branch 3.x visit http://localhost:8080/swagger/?version=3

Examples: examples

Development

Check code:

hatch run lint:all

Format code:

hatch run lint:fmt

Run tests:

hatch run pytest

Run tests with coverage:

hatch run cov

Metadata

Release files for aiohttp-apiset 0.9.18

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-apiset 0.9.18
File Size Uploaded Provenance Actions
aiohttp_apiset-0.9.18.tar.gz 11.7 MB Without provenance Details for aiohttp_apiset-0.9.18.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aiohttp-apiset 0.9.18
File Interpreter ABI Platform Actions
aiohttp_apiset-0.9.18-py3-none-any.whl Python 3 none any Details for aiohttp_apiset-0.9.18-py3-none-any.whl

Total release size: 23.6 MB

Release files / aiohttp_apiset-0.9.18.tar.gz

Download URL aiohttp_apiset-0.9.18.tar.gz
Size 11.7 MB
Tags Source
SHA-256 checksum
How to use checksums
9bef25674d3593d355ed418cfdbf73eb4814f46364168e0da0206e494235c032
BLAKE2b-256 checksum
How to use checksums
bdfcabb9e10ce2523506e3ffd4961de08ec99ced0d81fc5ea5be662e90be7f8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.28.1

Release files / aiohttp_apiset-0.9.18-py3-none-any.whl

Download URL aiohttp_apiset-0.9.18-py3-none-any.whl
Size 11.9 MB
Tags Python 3
SHA-256 checksum
How to use checksums
bdf251e9a198d3502c703a762b45c2ad571843e29708040a6af35dc4cc2fb851
BLAKE2b-256 checksum
How to use checksums
f4a08fd76addeadcc0bfe29584c69f17434c5a7dc59fb63fba2707fa3068d90e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.28.1

Security for aiohttp-apiset 0.9.18

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.

Release history Release notifications | RSS feed

This release

0.9.18 This release

2 release files No provenance

0.0.1

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