fastapi-limiter icon indicating copy to clipboard operation
fastapi-limiter copied to clipboard

Bug with latest version

Open hardbyte opened this issue 4 years ago • 4 comments
trafficstars

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"}

hardbyte avatar Aug 10 '21 22:08 hardbyte

Commit is great, please merge this one! Thank you so much!

marvingabler avatar Aug 29 '21 10:08 marvingabler

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

divadsn avatar Apr 05 '22 06:04 divadsn

https://pypi.org/project/fastapi-limiter/#history

hardbyte avatar Apr 06 '22 05:04 hardbyte

@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

divadsn avatar Apr 06 '22 17:04 divadsn