production-taskbar / backend / config / utils / throttles.py
throttles.py
Raw
from rest_framework.throttling import AnonRateThrottle
from rest_framework_api_key.permissions import HasAPIKey


class NoApiKeyAnonRateThrottle(AnonRateThrottle):
    scope = 'noapikey'

    def allow_request(self, request, view):    # type: ignore
        has_permission = HasAPIKey().has_permission(request, view)
        if has_permission:
            return True

        return super().allow_request(request, view)