From 4477e1777aa01bda0add51b792834eb2ab101cc9 Mon Sep 17 00:00:00 2001 From: Andrey Zhavoronkov <41117609+azhavoro@users.noreply.github.com> Date: Mon, 1 Jun 2020 20:19:39 +0300 Subject: [PATCH] Added throttling policy for unauthenticated users (#1531) * added throttling policy for unauthenticated users * updated changelog Co-authored-by: Nikita Manovich <40690625+nmanovic@users.noreply.github.com> --- CHANGELOG.md | 2 +- cvat/settings/base.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 867bef68..70ac40d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [1.1.0-alpha] - Unreleased ### Added -- +- Throttling policy for unauthenticated users () ### Changed - diff --git a/cvat/settings/base.py b/cvat/settings/base.py index 29c6fe85..9155f2b3 100644 --- a/cvat/settings/base.py +++ b/cvat/settings/base.py @@ -148,6 +148,12 @@ REST_FRAMEWORK = { # Disable default handling of the 'format' query parameter by REST framework 'URL_FORMAT_OVERRIDE': 'scheme', + 'DEFAULT_THROTTLE_CLASSES': [ + 'rest_framework.throttling.AnonRateThrottle', + ], + 'DEFAULT_THROTTLE_RATES': { + 'anon': '100/hour', + }, } REST_AUTH_REGISTER_SERIALIZERS = {