add basic rate limiting
This commit is contained in:
@ -3,7 +3,8 @@ import os
|
||||
import urllib.parse
|
||||
import regex
|
||||
import aiosqlite as sqlite3
|
||||
from fastapi import FastAPI, HTTPException
|
||||
from fastapi import FastAPI, HTTPException, Depends
|
||||
from fastapi_throttle import RateLimiter
|
||||
from fastapi.responses import JSONResponse
|
||||
from typing import LiteralString, Optional, Union, Iterable
|
||||
from regex import Pattern
|
||||
@ -76,6 +77,7 @@ class LyricSearch(FastAPI):
|
||||
handler,
|
||||
methods=["POST"],
|
||||
include_in_schema=_schema_include,
|
||||
dependencies=[Depends(RateLimiter(times=2, seconds=3))]
|
||||
)
|
||||
|
||||
async def typeahead_handler(self, data: ValidTypeAheadRequest) -> JSONResponse:
|
||||
|
Reference in New Issue
Block a user