Etag support for aiohttp.web
Project description
The library provides Etag support for aiohttp.web.
Most of the source code is ported from Tornado.
Installation
Install from PyPI:
pip install aiohttp-etag
Developing
Install requirement and launch tests:
pip install -r dev-requirements.txt pytest tests
Usage
A trivial usage example:
import asyncio
import time
import aiohttp_etag
from aiohttp import web
async def home(request):
last_visit = time.time()
text = 'Last visited: {}'.format(last_visit)
return web.Response(text=text)
async def resource(request):
last_visit = time.time()
return web.json_response({
'last_visit': last_visit,
})
async def make_app():
app = web.Application()
aiohttp_etag.setup(app)
app.router.add_get('/', home)
app.router.add_get('/resource', resource)
return app
web.run_app(make_app())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aiohttp-etag-0.0.1.tar.gz
(3.4 kB
view hashes)
Built Distribution
Close
Hashes for aiohttp_etag-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ba0d33d65a0a0e01ab963cb298ffc5e4f74be13090cc325a5aa82e4ce09f8c5 |
|
MD5 | c6361f7933abebc4c83fe2b1d4369fb5 |
|
BLAKE2b-256 | be89128683ecb1d72e6887b7c3da6de1aba4067492f37f44be30538dd78e37b7 |