fix: handle slowapi.errors import with fallback
All checks were successful
All checks were successful
- Add try/except for slowapi.errors import - Fall back to importing RateLimitExceeded from slowapi directly - Handles different slowapi package structures across versions - Fixes integration-tests CI import error
This commit is contained in:
@@ -30,9 +30,14 @@ from prometheus_client import Counter, Histogram, generate_latest, make_asgi_app
|
||||
from prometheus_client.core import CollectorRegistry
|
||||
from prometheus_client.exposition import CONTENT_TYPE_LATEST
|
||||
from slowapi import Limiter, _rate_limit_exceeded_handler
|
||||
from slowapi.errors import RateLimitExceeded
|
||||
from slowapi.util import get_remote_address
|
||||
|
||||
# RateLimitExceeded is now defined in slowapi directly, not in slowapi.errors
|
||||
try:
|
||||
from slowapi.errors import RateLimitExceeded
|
||||
except ImportError:
|
||||
from slowapi import RateLimitExceeded
|
||||
|
||||
from .config import settings
|
||||
from .utils.alerting import alert_dispatcher
|
||||
from .utils.cache import cache_manager
|
||||
|
||||
Reference in New Issue
Block a user