Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

evalsha() got an unexpected keyword argument 'keys' #18

Open
PaiHsuehChung opened this issue Sep 24, 2021 · 9 comments
Open

evalsha() got an unexpected keyword argument 'keys' #18

PaiHsuehChung opened this issue Sep 24, 2021 · 9 comments

Comments

@PaiHsuehChung
Copy link

HI:
Fist of all, I want to appreciate that you build such awesome tool.
When i use this library encounter some problem like title, which code write on

 File "/usr/local/lib/python3.8/site-packages/fastapi_limiter/depends.py", line 42, in __call__
    pexpire = await redis.evalsha(
TypeError: evalsha() got an unexpected keyword argument 'keys'

Environments:

  • python 3.8
  • aioredis == 2.0.0
  • fastapi-limiter==0.1.4
  • fastapi==0.68.1
@long2ice
Copy link
Owner

Upgrade fastapi-limiter

@ssinghgc
Copy link

Is this issue resolved? Still facing this.

@GGGoingdown
Copy link

@ssinghgc
When i using pip or poetry to install still facing this problem.
So you can build from source. It work for me (git+https://github.com/long2ice/fastapi-limiter.git)

@MarcWarrior
Copy link

Is this issue resolved? Still facing this.

You should upgrade fastapi-limiter to v0.1.4 or modify the original code like this:

rate_key = await identifier(request)
key = f"{FastAPILimiter.prefix}:{rate_key}:{index}"
pexpire = await redis.evalsha(
    FastAPILimiter.lua_sha, 1, key, str(self.times), str(self.milliseconds)
)

@UnknownFX02
Copy link

@MarcWarrior fastapi-limiter to v0.1.4 still have this issue, but will fix with your snippets. Can you update this package to pipy

@charlax
Copy link

charlax commented Mar 8, 2022

fastapi-limiter-0.1.4.tar.gz which is currently on pypi still has keys keyword argument. Can you push a new version?

Btw, https://github.com/aio-libs/aioredis-py is being merged into redis-py.

@Acendro
Copy link

Acendro commented Mar 10, 2022

I just came around the same issue and discovered a workaround that some of you might find helpful.
You can basically install the 1.0.6 version with: 'pip install https://github.com/hardbyte/fastapi-limiter/archive/patch-1.zip'
And in your requirements.txt just swap out the 'fastapi-limiter==xxx' to 'git+https://github.com/hardbyte/fastapi-limiter@patch-1'

Runs like a charm for me now =)

@WardPearce
Copy link

Yup is relevant to #20

Is the repo owner no longer maintaining this project?

@python-programmer
Copy link

python-programmer commented Oct 14, 2022

check your aioredis version, this version(fastapi-limiter on pypi == 0.1.4) doesn't work with aioredis >= 2.0

for version 2.0 and above, I think the maintainer must change the below code:

  pexpire = await redis.evalsha(
      FastAPILimiter.lua_sha, keys=[key], args=[self.times, self.milliseconds]
  )

TO

keys = [key]
pexpire = await redis.evalsha(
  FastAPILimiter.lua_sha, len(keys), *keys, self.times, self.milliseconds
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants