Spaces:
Sleeping
Sleeping
Global limit 100/10 minutes
Browse files
main.py
CHANGED
|
@@ -25,7 +25,7 @@ def client_ip(request: Request):
|
|
| 25 |
return xff.split(",")[0].strip() if xff else (request.client.host or "0.0.0.0")
|
| 26 |
|
| 27 |
limiter = Limiter(key_func=client_ip) # or get_remote_address
|
| 28 |
-
GLOBAL_LIMIT = limiter.limit("
|
| 29 |
|
| 30 |
app.state.limiter = limiter
|
| 31 |
app.add_middleware(SlowAPIMiddleware)
|
|
|
|
| 25 |
return xff.split(",")[0].strip() if xff else (request.client.host or "0.0.0.0")
|
| 26 |
|
| 27 |
limiter = Limiter(key_func=client_ip) # or get_remote_address
|
| 28 |
+
GLOBAL_LIMIT = limiter.limit("100/10minute", key_func=lambda: "global:any") # global limit
|
| 29 |
|
| 30 |
app.state.limiter = limiter
|
| 31 |
app.add_middleware(SlowAPIMiddleware)
|