from django.conf import settings
from django.urls import reverse


class IsApiRequest:
    @staticmethod
    def is_api_request(request):
        path = request.path.lower()
        for root_url in settings.OSCARAPI_ROOT_URLS:
            api_root = reverse(root_url).lower()
            if path.startswith(api_root):
                return True

        return False
