add basic rate limiting
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import os
|
||||
import aiosqlite as sqlite3
|
||||
from fastapi import FastAPI
|
||||
from fastapi import FastAPI, Depends
|
||||
from fastapi_throttle import RateLimiter
|
||||
from fastapi.responses import JSONResponse
|
||||
from typing import Optional, LiteralString, Union
|
||||
from .constructors import ValidShowEpisodeLineRequest, ValidShowEpisodeListRequest
|
||||
@ -24,7 +25,9 @@ class Transcriptions(FastAPI):
|
||||
|
||||
for endpoint, handler in self.endpoints.items():
|
||||
app.add_api_route(
|
||||
f"/{endpoint}", handler, methods=["POST"], include_in_schema=True
|
||||
f"/{endpoint}", handler,
|
||||
methods=["POST"], include_in_schema=True,
|
||||
dependencies=[Depends(RateLimiter(times=2, seconds=2))]
|
||||
)
|
||||
|
||||
async def get_episodes_handler(
|
||||
|
Reference in New Issue
Block a user