Delete api/rpmlimits.py
Browse files- api/rpmlimits.py +0 -17
api/rpmlimits.py
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
from slowapi.util import get_remote_address
|
2 |
-
from slowapi import Limiter
|
3 |
-
from fastapi import Request
|
4 |
-
|
5 |
-
# Initialize a limiter instance
|
6 |
-
limiter = Limiter(key_func=get_remote_address)
|
7 |
-
|
8 |
-
def check_rate_limit(request: Request):
|
9 |
-
"""
|
10 |
-
Function to check if a user has exceeded their rate limit.
|
11 |
-
This is managed by slowapi's limiter.
|
12 |
-
"""
|
13 |
-
if not limiter.is_allowed(request):
|
14 |
-
raise HTTPException(
|
15 |
-
status_code=429,
|
16 |
-
detail="Rate limit exceeded. Please try again later."
|
17 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|