A FastAPI rate limiting library.
Project description
Farl
A powerful and flexible FastAPI rate limiting library that provides comprehensive rate limiting capabilities for your FastAPI applications.
Features
- Easy Integration: Simple setup with FastAPI applications
- Flexible Configuration: Support for various rate limiting strategies
- Multiple Backends: In-memory and Redis backend support
- Comprehensive Protection: Request rate limiting with customizable rules
- Monitoring: Built-in metrics and logging capabilities
- Dependency Injection: FastAPI-style dependency injection support
Installation
pip install farl
Optional Dependencies
For Redis backend support:
pip install farl[redis]
Quick Start
from fastapi import Depends, FastAPI
from farl import (
AsyncFarl,
FarlError,
farl_exceptions_handler,
rate_limit,
)
# Using Redis backend
farl = AsyncFarl()
app = FastAPI()
app.add_exception_handler(FarlError, farl_exceptions_handler)
@app.get(
"/",
dependencies=[
Depends(
rate_limit({"amount": 1}),
)
],
)
async def pre_minute_1_request():
return {"message": "ok"}
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file farl-0.0.7.tar.gz.
File metadata
- Download URL: farl-0.0.7.tar.gz
- Upload date:
- Size: 47.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb30e9a62bfeb2e125f6b08a0fe889d3e3c0b1c8244a2b09d33ef519b279633e
|
|
| MD5 |
326b25d562d216e1a9bca92e5cdbd8bf
|
|
| BLAKE2b-256 |
d47de783a41ac6b6062f22c4aeafe7c57a28daa3a3eeb0ebc61972c6f77fde74
|
Provenance
The following attestation bundles were made for farl-0.0.7.tar.gz:
Publisher:
ci.yml on nafnix/farl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
farl-0.0.7.tar.gz -
Subject digest:
cb30e9a62bfeb2e125f6b08a0fe889d3e3c0b1c8244a2b09d33ef519b279633e - Sigstore transparency entry: 398541464
- Sigstore integration time:
-
Permalink:
nafnix/farl@67335dd3db898ccaa58384864d4b22df9a182a34 -
Branch / Tag:
refs/tags/v0.0.7 - Owner: https://github.com/nafnix
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@67335dd3db898ccaa58384864d4b22df9a182a34 -
Trigger Event:
push
-
Statement type:
File details
Details for the file farl-0.0.7-py3-none-any.whl.
File metadata
- Download URL: farl-0.0.7-py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b15c5d2fbb7fdaf744f4664bc92f16ebf0deb29d18cfc9df6a763ad020219110
|
|
| MD5 |
a13ccd70355721b1cb960e9a2877351c
|
|
| BLAKE2b-256 |
48040e5c80d4d26a848473e8ae4b2dd570a488b1ec276680e93e0fe0aafef3d8
|
Provenance
The following attestation bundles were made for farl-0.0.7-py3-none-any.whl:
Publisher:
ci.yml on nafnix/farl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
farl-0.0.7-py3-none-any.whl -
Subject digest:
b15c5d2fbb7fdaf744f4664bc92f16ebf0deb29d18cfc9df6a763ad020219110 - Sigstore transparency entry: 398541508
- Sigstore integration time:
-
Permalink:
nafnix/farl@67335dd3db898ccaa58384864d4b22df9a182a34 -
Branch / Tag:
refs/tags/v0.0.7 - Owner: https://github.com/nafnix
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@67335dd3db898ccaa58384864d4b22df9a182a34 -
Trigger Event:
push
-
Statement type: