fastapi-limiter
fastapi-limiter copied to clipboard
Bug with latest version
Creating a new project with latest versions of fastapi and fastapi-limiter runs into an issue:
TypeError: evalsha() got an unexpected keyword argument 'keys'
I used the following test code:
import aioredis
from fastapi import Depends, FastAPI
from fastapi_limiter import FastAPILimiter
from fastapi_limiter.depends import RateLimiter
app = FastAPI()
@app.on_event("startup")
async def startup():
redis = await aioredis.from_url("redis://localhost", encoding="utf-8", decode_responses=True)
await FastAPILimiter.init(redis)
@app.get("/", dependencies=[Depends(RateLimiter(times=2, seconds=5))])
async def index():
return {"message": "Hello World"}
Commit is great, please merge this one! Thank you so much!
Can't really reproduce that one, using latest aioredis and Python 3.10 everything works fine on 0.1.5 :thinking:
Edit: That bug is on 0.1.4, which is using aioredis 1.3.1, while the repo is already on aioredis 2.0.0
https://pypi.org/project/fastapi-limiter/#history
@hardbyte and? The latest version in the repo is 0.1.5, which is updated to use aioredis 2.0.0 and works totally fine, just use that until @long2ice eventually pushes that one to PyPi.
https://github.com/long2ice/fastapi-limiter/pull/17#issuecomment-1088301326