Skip to main content

Declare and validate HTTP query and path parameters in aiohttp

Project description

aiohttp-parameter-parser

Declare and validate HTTP query and path parameters in aiohttp views. Currently only path and URL query parameter location are supported.

Example usage:

from aiohttp import web

from aiohttp_parameter_parser import ParameterView


class ExampleHandler(ParameterView):
    async def get(self) -> web.Response:
        my_array_of_ints: int = self.query_parameter(
            "parameter_name_in_request",
            required=True,
            is_array=True,
            is_int=True,
        )
        # If provided parameter is of wrong type or missing, 
        # a default HTTP 400 response is returned to client.

        return web.json_response({"received_param": my_array_of_ints})

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

aiohttp-parameter-parser-0.1.4.tar.gz (3.8 kB view hashes)

Uploaded Source

Built Distribution

aiohttp_parameter_parser-0.1.4-py3-none-any.whl (5.1 kB view hashes)

Uploaded Python 3

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