Skip to content

views#

DownloadUnavailableException#

Bases: APIException

Source code in src/apps/download/views.py
6
7
8
9
class DownloadUnavailableException(exceptions.APIException):
    status_code = 503
    default_detail = "Download service unavailable."
    default_code = "service_unavailable"

DownloadViewSet#

Bases: ViewSet

Source code in src/apps/download/views.py
class DownloadViewSet(ViewSet):
    def not_implemented_detail(self, endpoint_detail):
        return f"{endpoint_detail} through Metax V3 not implemented."

    @action(detail=False, methods=["get", "post"])
    def packages(self, request):
        """Placeholder for getting available packages and requesting package generation from download service."""
        if request.method == "GET":
            raise DownloadUnavailableException(
                detail=self.not_implemented_detail("Getting available packages")
            )
        else:
            raise DownloadUnavailableException(
                detail=self.not_implemented_detail("Requesting package generation")
            )

    @action(detail=False, methods=["post"])
    def authorize(self, request):
        """Placeholder for authorizing a resource for download from download service."""
        raise DownloadUnavailableException(
            detail=self.not_implemented_detail("Resource authorization")
        )

    @action(detail=False, methods=["post"])
    def subscribe(self, request):
        """Placeholder for subscribing to an email notification from download service when package creation is ready."""
        raise DownloadUnavailableException(
            detail=self.not_implemented_detail("Package subscriptions")
        )

    @action(detail=False, methods=["post"])
    def notifications(self, request):
        """Placeholder for sending package ready -notification to a subscriber"""
        raise DownloadUnavailableException(
            detail=self.not_implemented_detail("Package notifications")
        )

authorize(request) #

Placeholder for authorizing a resource for download from download service.

Source code in src/apps/download/views.py
@action(detail=False, methods=["post"])
def authorize(self, request):
    """Placeholder for authorizing a resource for download from download service."""
    raise DownloadUnavailableException(
        detail=self.not_implemented_detail("Resource authorization")
    )

notifications(request) #

Placeholder for sending package ready -notification to a subscriber

Source code in src/apps/download/views.py
@action(detail=False, methods=["post"])
def notifications(self, request):
    """Placeholder for sending package ready -notification to a subscriber"""
    raise DownloadUnavailableException(
        detail=self.not_implemented_detail("Package notifications")
    )

packages(request) #

Placeholder for getting available packages and requesting package generation from download service.

Source code in src/apps/download/views.py
@action(detail=False, methods=["get", "post"])
def packages(self, request):
    """Placeholder for getting available packages and requesting package generation from download service."""
    if request.method == "GET":
        raise DownloadUnavailableException(
            detail=self.not_implemented_detail("Getting available packages")
        )
    else:
        raise DownloadUnavailableException(
            detail=self.not_implemented_detail("Requesting package generation")
        )

subscribe(request) #

Placeholder for subscribing to an email notification from download service when package creation is ready.

Source code in src/apps/download/views.py
@action(detail=False, methods=["post"])
def subscribe(self, request):
    """Placeholder for subscribing to an email notification from download service when package creation is ready."""
    raise DownloadUnavailableException(
        detail=self.not_implemented_detail("Package subscriptions")
    )