Add info throttler
This commit is contained in:
parent
5be51de1ea
commit
af06d6491b
3 changed files with 11 additions and 2 deletions
|
|
@ -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
|
||||
6
engine/apps/public_api/throttlers/info_throttler.py
Normal file
6
engine/apps/public_api/throttlers/info_throttler.py
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
from rest_framework.throttling import UserRateThrottle
|
||||
|
||||
|
||||
class InfoThrottler(UserRateThrottle):
|
||||
scope = "info"
|
||||
rate = "100/m"
|
||||
|
|
@ -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}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue