You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
File "/usr/local/lib/python3.7/site-packages/ratelimitbackend/backends.py", line 33, in authenticate
counts = self.get_counters(request)
File "/usr/local/lib/python3.7/site-packages/ratelimitbackend/backends.py", line 60, in get_counters
return cache.get_many(self.keys_to_check(request))
File "/usr/local/lib/python3.7/site-packages/ratelimitbackend/backends.py", line 68, in keys_to_check
) for minute in range(self.minutes + 1)
File "/usr/local/lib/python3.7/site-packages/ratelimitbackend/backends.py", line 68, in <listcomp>
) for minute in range(self.minutes + 1)
File ".../settings/ratelimit.py", line 15, in key
return f'{request.POST[self.username_key][:max_username_length]}-{dt}'
File "/usr/local/lib/python3.7/site-packages/django/utils/datastructures.py", line 79, in __getitem__
raise MultiValueDictKeyError(key)
django.utils.datastructures.MultiValueDictKeyError: 'username'
from backends.py/RateLimitMixin:
def authenticate(self, request=None, **kwargs):
username = None
try:
username = kwargs[self.username_key]
except KeyError:
if not self.no_username:
raise
So username is expected to be passed through **kwargs, not request. Can't make the example work without override-ing authenticate, get_counters, get_cache_key, key.
The text was updated successfully, but these errors were encountered:
Following https://django-ratelimit-backend.readthedocs.io/en/latest/usage.html#customizing-rate-limiting-criteria
from
backends.py/RateLimitMixin
:So username is expected to be passed through
**kwargs
, notrequest
. Can't make the example work without override-ingauthenticate
,get_counters
,get_cache_key
,key
.The text was updated successfully, but these errors were encountered: