Handy utilities for aiohttp.web applications.
Project description
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/.
Project Links
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.2.1.tar.gz
(20.1 kB
view details)
Built Distribution
File details
Details for the file aiohttp-utils-3.2.1.tar.gz
.
File metadata
- Download URL: aiohttp-utils-3.2.1.tar.gz
- Upload date:
- Size: 20.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50959c43af1a5ef830bc7ad62c1e8d805946a41e75561169487bcfb89ab5203c |
|
MD5 | 2f1be10d998b973e71b551bf4e4d7a2d |
|
BLAKE2b-256 | fc754b2fda5623ec032af5b8c603967eee3e437d3a257fff661ddfcf1d1facf7 |
File details
Details for the file aiohttp_utils-3.2.1-py2.py3-none-any.whl
.
File metadata
- Download URL: aiohttp_utils-3.2.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/4.0.2 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ea1d6e20c6c29062ba6bffbd8aa8cb852dbf0403499908c473f3932c0d7877b |
|
MD5 | 37cd80499010713205511c12f1058b55 |
|
BLAKE2b-256 | 0669cdae27ac34ccb3d0616f963ab03159e2e59b21e62ae3d08bfc171f48683b |