Add info throttler

This commit is contained in:
Innokentii Konstantinov 2022-06-08 18:25:58 +04:00
parent 5be51de1ea
commit af06d6491b
3 changed files with 11 additions and 2 deletions

View file

@ -0,0 +1,3 @@
from .info_throttler import InfoThrottler # noqa: F401
from .phone_notification_throttler import PhoneNotificationThrottler # noqa: F401
from .user_throttle import UserThrottle # noqa: F401

View file

@ -0,0 +1,6 @@
from rest_framework.throttling import UserRateThrottle
class InfoThrottler(UserRateThrottle):
scope = "info"
rate = "100/m"

View file

@ -3,14 +3,14 @@ from rest_framework.response import Response
from rest_framework.views import APIView
from apps.auth_token.auth import ApiTokenAuthentication
from apps.public_api.throttlers.user_throttle import UserThrottle
from apps.public_api.throttlers import InfoThrottler
class InfoView(APIView):
authentication_classes = (ApiTokenAuthentication,)
permission_classes = (IsAuthenticated,)
throttle_classes = [UserThrottle]
throttle_classes = [InfoThrottler]
def get(self, request):
response = {"url": self.request.auth.organization.grafana_url}