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

Uploaded Source

Built Distribution

aiohttp_utils-3.1.0-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.0.tar.gz.

File metadata

  • Download URL: aiohttp_utils-3.1.0.tar.gz
  • Upload date:
  • Size: 18.0 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.0.tar.gz
Algorithm Hash digest
SHA256 e3a3b5532665e863fd2b0901ded1ddd683e774fe67f525fbda248d581750b132
MD5 b59b50aa07b8e9c5e5cc754828dd6668
BLAKE2b-256 016927e8c849c27e2a5d3e774b0c8459598f3ecbc542fbf3ecfe929549aa15b2

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: aiohttp_utils-3.1.0-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.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e50adebcb8ec811e274ddebf6e1c21aaeb2d1124fc63eab6079e48a8055de5e3
MD5 de5759617e9ff010f8fd61060b14acfc
BLAKE2b-256 b53f0846ea190ec64a04ff614927a618e327ca65dc7aef1f72c27953892a0eaf

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