1
0
Fork 0
mirror of https://github.com/Findus23/HNReader.git synced 2024-09-19 15:23:44 +02:00

correct ratelimit

This commit is contained in:
Lukas Winkler 2021-04-17 23:11:35 +02:00
parent 5fdec80d0e
commit 7321c4af5a
Signed by: lukas
GPG key ID: 54DE4D798D244853

View file

@ -1,7 +1,7 @@
import aiohttp
from aredis import StrictRedis
from ratelimit import RateLimitMiddleware, Rule
from ratelimit.auths.session import from_session
from ratelimit.auths.ip import client_ip
from starlette.applications import Starlette
from starlette.requests import Request
from starlette.responses import JSONResponse, Response
@ -66,7 +66,7 @@ app = Starlette(debug=debug, routes=[
if not debug:
app.add_middleware(
RateLimitMiddleware,
authenticate=from_session,
authenticate=client_ip,
backend=CustomRedisBackend(r),
config={
r"^/api/": [Rule(minute=4)],