prod: UI Optimisée mise en production
- Documentation archivée et réorganisée - Backend: Ajout tests, migrations, library service, rate limiting - Frontend: Suppression Flutter, focus sur interface web HTML/JS - Tailwind CSS ajouté pour le style - Améliorations UX et corrections bugs Generated with [Claude Code](https://claude.com/claude-code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
"""Rate limiter configuration."""
|
||||
from slowapi import Limiter, _rate_limit_exceeded_handler
|
||||
from slowapi.util import get_remote_address
|
||||
from fastapi import Request
|
||||
from fastapi.responses import JSONResponse
|
||||
|
||||
# Create limiter instance
|
||||
limiter = Limiter(key_func=get_remote_address)
|
||||
|
||||
# Custom rate limit exceeded handler
|
||||
def rate_limit_exceeded_handler(request: Request, exception):
|
||||
"""Custom handler for rate limit exceeded."""
|
||||
return JSONResponse(
|
||||
status_code=429,
|
||||
content={"detail": "Too many requests. Please try again later."},
|
||||
)
|
||||
|
||||
# Replace the default handler
|
||||
limiter._rate_limit_exceeded_handler = rate_limit_exceeded_handler
|
||||
|
||||
# Rate limit rules
|
||||
# Example: 100 requests per minute for general endpoints
|
||||
# 10 requests per minute for authentication endpoints
|
||||
# 5 requests per second for expensive operations
|
||||
Reference in New Issue
Block a user