Skip to main content

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for aiohttp-etag, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size aiohttp_etag-0.0.1-py3-none-any.whl (3.2 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size aiohttp-etag-0.0.1.tar.gz (3.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page