Skip to main content

A FastAPI decorator for rate limiting requests based on specified parameters.

Project description

Installation

pip install fastapi-request-limit

Usage

Here's how you can use the request-limit decorator in a FastAPI application:~

from fastapi import FastAPI, Request
from fastapi.responses import JSONResponse
from fastapi_request_limit import request_limit

app = FastAPI()

@app.post("/", response_class=JSONResponse)
@request_limit(seconds=5, data=["foo", "bar"])
async def root(foo: str, bar: int, request: Request):
    return JSONResponse(content={"message": f"Request accepted for {foo} and {bar}"})

Parameters

  • seconds (int): The number of seconds required between requests with the same parameter values.
  • data (List[str]): A list of parameter names to use for rate limiting.

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

fastapi_request_limit-0.1.4.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastapi_request_limit-0.1.4-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file fastapi_request_limit-0.1.4.tar.gz.

File metadata

  • Download URL: fastapi_request_limit-0.1.4.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.1

File hashes

Hashes for fastapi_request_limit-0.1.4.tar.gz
Algorithm Hash digest
SHA256 d8de353ab48c37ddcfe8a48833b8a98ca1953471c62e2d54e55ac18601a58a7c
MD5 56b8be70968a3acfde53c1de618e6efe
BLAKE2b-256 60b4cdd28600f61d22a6ed80bb5199caf12c2711440a2866c0767ee523a947b4

See more details on using hashes here.

File details

Details for the file fastapi_request_limit-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for fastapi_request_limit-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 95dc84a49d93d3b040c0202459b2a528fa9e5938f3e901cd8e7a0630b16d8e19
MD5 5d401ea5e4aab2a0248fe05b363bb2a8
BLAKE2b-256 b6c1c3c974c12649828a958f5750daa66719beba0994b89f767faaf561c6cdd1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page