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


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)

Uploaded Source

Built Distribution

aiohttp_etag-0.0.1-py3-none-any.whl (3.2 kB view hashes)

Uploaded Python 3

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