Buckets:

download
raw
854 Bytes
"""Per-endpoint rate limiting using slowapi."""
from slowapi import Limiter
from slowapi.util import get_remote_address
# Rate limit tiers
TIER_AUTH = "5/minute" # Authentication endpoints (login, register)
TIER_WRITE = "30/minute" # Write/mutation endpoints (POST, PUT, DELETE)
TIER_READ = "120/minute" # Read endpoints (GET listings)
TIER_HEALTH = "300/minute" # Health/status/docs endpoints
def create_limiter() -> Limiter:
"""Create the rate limiter with optional Redis backend."""
import os
storage_uri = os.getenv("REDIS_URL") # None = in-memory, redis://... = distributed
return Limiter(
key_func=get_remote_address,
storage_uri=storage_uri,
default_limits=[TIER_READ], # Default for endpoints without explicit decorator
)
# Module-level singleton
limiter = create_limiter()

Xet Storage Details

Size:
854 Bytes
·
Xet hash:
f9a71e4114531da95d71153c5aa60d17d5c3a1d6ebda9fe0c8e360f7d1763e20

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.