Add rate limiting for any API calls
Review Request #8839 — Created March 24, 2017 and discarded
There's been a request to create a rate-limit for API calls. I have updated the ratelimit.py file that will allow rate limiting of API calls by either an authenticated user or an IP address.
None at the moment.
Description | From | Last Updated |
---|---|---|
local variable 'DEFAULT_RATE' is assigned to but never used |
reviewbot | |
'django.test.utils.override_settings' imported but unused |
reviewbot | |
'django.conf.settings' imported but unused |
reviewbot | |
This should not be ALLCAPS. Only class-level and top-level constants are all-caps. |
brennie | |
This can be simplified to: if not api_limit: #... else: # ... |
brennie | |
Shouldnt the default param be self.DEFAULT_RATE ? |
brennie | |
local variable 'DEFAULT_RATE' is assigned to but never used |
reviewbot | |
This should be the default_rate |
brennie | |
'django.conf.settings' imported but unused |
reviewbot | |
Re-flow this to 79ch wide. |
brennie | |
This should use a constant instead of repeating 5/m everywhere. |
brennie | |
undefined name 'WebAPIResourceRateLimitMixin' |
reviewbot | |
undefined name 'increment' |
reviewbot | |
undefined name '_' |
reviewbot | |
'djblets.webapi.resources.mixins.api_ratelimit.WebAPIResourceMixin' imported but unused |
reviewbot | |
undefined name 'increment' |
reviewbot | |
undefined name '_' |
reviewbot | |
'djblets.auth.ratelimit.Rate' imported but unused |
reviewbot | |
'djblets.auth.ratelimit.is_ratelimited' imported but unused |
reviewbot | |
'warnings' imported but unused |
reviewbot | |
'django.db.models.Model' imported but unused |
reviewbot | |
'django.utils.six' imported but unused |
reviewbot | |
'django.utils.translation.ugettext_lazy as _' imported but unused |
reviewbot | |
'djblets.auth.ratelimit.Rate' imported but unused |
reviewbot | |
'djblets.webapi.resources.registry.unregister_resource_for_model' imported but unused |
reviewbot | |
'djblets.webapi.resources.registry.register_resource_for_model' imported but unused |
reviewbot | |
local variable 'result' is assigned to but never used |
reviewbot | |
'djblets.auth.ratelimit.Rate' imported but unused |
reviewbot | |
'djblets.webapi.resources.registry.unregister_resource' imported but unused |
reviewbot |
- Change Summary:
-
Added test for new mixin, along with documentation.