Skip to main content

A FastAPI rate limiting library.

Project description

Farl

Python 3.11+ PyPI version Code Coverage License

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

farl-0.0.8.tar.gz (54.8 kB view details)

Uploaded Source

Built Distribution

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

farl-0.0.8-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file farl-0.0.8.tar.gz.

File metadata

  • Download URL: farl-0.0.8.tar.gz
  • Upload date:
  • Size: 54.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for farl-0.0.8.tar.gz
Algorithm Hash digest
SHA256 4933677606267061f3c5fe960ca487dbf2bfc037f8f41c25b57e7bc36c288dce
MD5 441b0592b53b407c7c3ab9b763db0403
BLAKE2b-256 2bd3772acaec333a6059bcbf4c02d007dba3572295a9ab18ac7c38f1a0b95320

See more details on using hashes here.

Provenance

The following attestation bundles were made for farl-0.0.8.tar.gz:

Publisher: ci.yml on nafnix/farl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file farl-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: farl-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for farl-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 bc2728b0a5c2ba30c3337635d29aa5df292923140dc678d64730280f2d9b0529
MD5 fa8b77960e5fa5e2a3c7ba24dfb20bc2
BLAKE2b-256 0e5e95a95081d8403b6bc0eaa1adee2105021bf29c2a260c7678fc0707e32795

See more details on using hashes here.

Provenance

The following attestation bundles were made for farl-0.0.8-py3-none-any.whl:

Publisher: ci.yml on nafnix/farl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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