Skip to main content

A simple ratelimiter for aiohttp.web

Project description

aiohttp-ratelimiter

This library allows you to add a rate limit to your aiohttp.web app.

Install from git

python -m pip install git+https://github.com/Nebulizer1213/aiohttp-ratelimiter

Install from pypi

python -m pip install aiohttp-ratelimiter

Example

from aiohttplimiter import limit
from aiohttp import web

app = web.Application()
routes = web.RouteTableDef()

# This endpoint can only be requested one time per second per IP address.
@routes.get("/")
@limit(ratelimit="1/1", keyfunc=default_keyfunc)
async def test(request):
    return web.Response(text="test")

app.add_routes(routes)
web.run_app(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-ratelimiter-1.0.1.tar.gz (2.6 kB view hashes)

Uploaded Source

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