From eb2c8439fe30f35ac5f1e15555122818030e90d2 Mon Sep 17 00:00:00 2001 From: corbz Date: Wed, 17 Jan 2024 23:19:16 +0000 Subject: [PATCH] =?UTF-8?q?Implement=20API=20rate=20limits=20=E2=80=A2=201?= =?UTF-8?q?000/day?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/settings.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/core/settings.py b/core/settings.py index 1960a21..156ee1b 100644 --- a/core/settings.py +++ b/core/settings.py @@ -214,6 +214,20 @@ MEDIA_URL = '/media/' ############################################################# ############################################################# +REST_FRAMEWORK = { + 'DEFAULT_THROTTLE_CLASSES': [ + 'rest_framework.throttling.AnonRateThrottle', + 'rest_framework.throttling.UserRateThrottle' + ], + 'DEFAULT_THROTTLE_RATES': { + 'anon': '100/day', + 'user': '1000/day' + } +} + +############################################################# +############################################################# + # If route isnt found, try again with appended slash APPEND_SLASH = True