Update main.py
This commit is contained in:
1 parent
5be51bf199
commit
122bf7829f
1 file changed
+9
@@ -2,8 +2,17 @@ import threading
|
||||
import time
|
||||
import fastapi
|
||||
import requests
|
||||
from slowapi import Limiter, _rate_limit_exceeded_handler
|
||||
from slowapi.errors import RateLimitExceeded
|
||||
from slowapi.middleware import SlowAPIMiddleware
|
||||
from slowapi.util import get_remote_address
|
||||
|
||||
|
||||
limiter = Limiter(key_func=get_remote_address, default_limits=["50/second"])
|
||||
app = fastapi.FastAPI()
|
||||
app.state.limiter = limiter
|
||||
app.add_exception_handler(RateLimitExceeded, _rate_limit_exceeded_handler)
|
||||
app.add_middleware(SlowAPIMiddleware)
|
||||
lanyard_link = "https://api.lanyard.rest/v1/users/1558056824387805300"
|
||||
CACHE_TTL = 1.0
|
||||
_cache = {"data": None, "time": 0.0}
|
||||
|
||||
Reference in new issue
Block a user