style: apply black and isort formatting across entire codebase
- Standardize quote style (single to double quotes) - Reorder and group imports alphabetically - Fix line breaks and indentation for consistency - Apply PEP 8 formatting standards Also updated Makefile to exclude both venv and .venv from code quality checks. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -9,12 +9,14 @@ This module provides classes and functions for:
|
||||
"""
|
||||
|
||||
from functools import wraps
|
||||
|
||||
from app.exceptions.base import RateLimitException # Add this import
|
||||
from middleware.rate_limiter import RateLimiter
|
||||
|
||||
# Initialize rate limiter instance
|
||||
rate_limiter = RateLimiter()
|
||||
|
||||
|
||||
def rate_limit(max_requests: int = 100, window_seconds: int = 3600):
|
||||
"""Rate limiting decorator for FastAPI endpoints."""
|
||||
|
||||
@@ -26,10 +28,11 @@ def rate_limit(max_requests: int = 100, window_seconds: int = 3600):
|
||||
if not rate_limiter.allow_request(client_id, max_requests, window_seconds):
|
||||
# Use custom exception instead of HTTPException
|
||||
raise RateLimitException(
|
||||
message="Rate limit exceeded",
|
||||
retry_after=window_seconds
|
||||
message="Rate limit exceeded", retry_after=window_seconds
|
||||
)
|
||||
|
||||
return await func(*args, **kwargs)
|
||||
|
||||
return wrapper
|
||||
|
||||
return decorator
|
||||
|
||||
Reference in New Issue
Block a user