mirror of
https://github.com/Findus23/HNReader.git
synced 2024-09-19 15:23:44 +02:00
correct ratelimit
This commit is contained in:
parent
5fdec80d0e
commit
7321c4af5a
1 changed files with 2 additions and 2 deletions
|
@ -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)],
|
||||
|
|
Loading…
Reference in a new issue