JGLTechnologies / aiohttp-ratelimiter

A rate limiter for the aiohttp.web framework
MIT License
14 stars 5 forks source link

@limiter.limit doesn't render ratelimit value correctly #1

Closed dmdhrumilmistry closed 1 year ago

dmdhrumilmistry commented 1 year ago

Bug Report

On using below decorator from README file

@limiter.limit("1/second")

raises Value Error

ValueError: invalid literal for int() with base 10: 'second'

I guess, decorator doesn't work with aiohttp.web Views

Python version

$ python --version
Python 3.10.4

OS

Windows 11

Nebulizer1213 commented 1 year ago
@routes.get("/")
@limiter.limit("1/second")
async def home(request):
    return web.Response(text="test")

This works fine for me. Make sure you are using aiohttp-ratelimiter version 4.0.0

dmdhrumilmistry commented 1 year ago
@routes.get("/")
@limiter.limit("1/second")
async def home(request):
    return web.Response(text="test")

This works fine for me. Make sure you are using aiohttp-ratelimiter version 4.0.0

Yikes, I'm working with 3.5,3 version, need to update, but I'm unable to install emcache. Error has been pasted below:

$ pip install -U aiohttp-ratelimiter==4.0.0
Collecting aiohttp-ratelimiter==4.0.0
  Using cached aiohttp-ratelimiter-4.0.0.tar.gz (5.1 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: aiohttp in d:\soft_installed\python\lib\site-packages (from aiohttp-ratelimiter==4.0.0) (3.8.1)
Requirement already satisfied: limits in d:\soft_installed\python\lib\site-packages (from aiohttp-ratelimiter==4.0.0) (2.7.0)
Requirement already satisfied: coredis in d:\soft_installed\python\lib\site-packages (from aiohttp-ratelimiter==4.0.0) (4.6.0)
ERROR: Could not find a version that satisfies the requirement emcache (from aiohttp-ratelimiter) (from versions: none)
ERROR: No matching distribution found for emcache
Nebulizer1213 commented 1 year ago

I'm pretty sure you can just ignore that error. If 4.0.0 was successfully installed then you should be fine.

dmdhrumilmistry commented 1 year ago

Okay thanks, @Nebulizer1213

I'll test and if it works fine, I'll close the issue.

dmdhrumilmistry commented 1 year ago

I'm pretty sure you can just ignore that error. If 4.0.0 was successfully installed then you should be fine.

I'm unable to upgrade to the latest version. It returns same error.

I've suggested couple of suggested changes in setup.py file

Nebulizer1213 commented 1 year ago

I just released 4.0.1 and this should be fixed

dmdhrumilmistry commented 1 year ago

cool, I'll verify and close the issue soon.