Closed mcantrell closed 2 months ago
I'm getting the following error when trying to use the memory storage with the async version of MovingWindowRateLimiter.
../.venv/lib/python3.11/site-packages/limits/aio/strategies.py:16: in __init__ assert isinstance(storage, Storage) E AssertionError
I see another related issue that was resolved by fixing the import for the strategy:
https://github.com/alisaifee/limits/issues/171
I don't believe this is related. The test detailed below shows the proper import.
import pytest from limits import parse from limits.storage import storage_from_string from limits.aio.strategies import MovingWindowRateLimiter memory_store = storage_from_string("memory://") moving_window = MovingWindowRateLimiter(memory_store) one_per_minute = parse("1/minute") @pytest.mark.asyncio async def test_hit(): result = await moving_window.hit(one_per_minute, "test_namespace", "foo") assert result is True
limits version: 3.13.0 os: MacOS Sonoma 14.5 python: 3.11.9
argh, my mistake. I missed the async part of the storage uri:
memory:// vs asyc+memory://
memory://
asyc+memory://
Closing this but maybe this might help someone else that is copy/paste editing too quickly 😂
I'm getting the following error when trying to use the memory storage with the async version of MovingWindowRateLimiter.
I see another related issue that was resolved by fixing the import for the strategy:
https://github.com/alisaifee/limits/issues/171
I don't believe this is related. The test detailed below shows the proper import.
Steps to Reproduce
Your Environment
limits version: 3.13.0 os: MacOS Sonoma 14.5 python: 3.11.9