Skip to main content

Handy utilities for aiohttp.web applications.

Project description

Latest version Travis-CI

aiohttp_utils provides handy utilities for building aiohttp.web applications.

  • Method-based handlers (“resources”)

  • Routing utilities

  • Content negotiation with JSON rendering by default

Everything is optional. You can use as much (or as little) of this toolkit as you need.

from aiohttp import web
from aiohttp_utils import Response, routing, negotiation

app = web.Application(router=routing.ResourceRouter())

# Method-based handlers
class HelloResource:

    async def get(self, request):
        name = request.GET.get('name', 'World')
        return Response({
            'message': 'Hello ' + name
        })


app.router.add_resource_object('/', HelloResource())

# Content negotiation
negotiation.setup(
    app, renderers={
        'application/json': negotiation.render_json
    }
)

Install

$ pip install aiohttp_utils

Documentation

Full documentation is available at https://aiohttp-utils.readthedocs.io/.

License

MIT licensed. See the bundled LICENSE file for more details.

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_utils-3.1.1.tar.gz (19.1 kB view details)

Uploaded Source

Built Distribution

aiohttp_utils-3.1.1-py2.py3-none-any.whl (10.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file aiohttp_utils-3.1.1.tar.gz.

File metadata

  • Download URL: aiohttp_utils-3.1.1.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for aiohttp_utils-3.1.1.tar.gz
Algorithm Hash digest
SHA256 08f2c4dc15a3fd193aa904a21f4ff365f5bae0b13a6764f3e7d05a3bb802dc14
MD5 e7f0f1395e085f5b76ead60efb2510e0
BLAKE2b-256 80cac7634d1f1976342baefb1dc9e34534829f2d96860f2e39bfc4ecba4a7523

See more details on using hashes here.

Provenance

File details

Details for the file aiohttp_utils-3.1.1-py2.py3-none-any.whl.

File metadata

  • Download URL: aiohttp_utils-3.1.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for aiohttp_utils-3.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 86fde4ede2f1d08b5d423765208fd069f4b02e65a8e9cfd87cbf063436b6aa1f
MD5 f14af8e53f81052e5b28de6c2ce11a5c
BLAKE2b-256 ffcaeb78b26336877843632cf14901b82f7673db9a42a430834c1bcd8e83808a

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