See #261: Added a rate-limiting (throttling system) to limit the number of requests handled per user/IP

This commit is contained in:
Eliot Berriot 2019-09-17 11:23:59 +02:00
parent 8666afc64f
commit d28bf65d00
20 changed files with 1077 additions and 19 deletions

View file

@ -49,6 +49,12 @@ class ReportsViewSet(mixins.CreateModelMixin, viewsets.GenericViewSet):
ordering_fields = ("creation_date",)
anonymous_policy = "setting"
anonymous_scopes = {"write:reports"}
throttling_scopes = {
"create": {
"anonymous": "anonymous-reports",
"authenticated": "authenticated-reports",
}
}
def get_serializer_context(self):
context = super().get_serializer_context()