swh.web.utils.exc module#
- exception swh.web.utils.exc.BadInputExc[source]#
- Bases: - ValueError- Wrong request to the api. - Example: Asking a content with the wrong identifier format. 
- exception swh.web.utils.exc.NotFoundExc[source]#
- Bases: - ObjectDoesNotExist- Good request to the api but no result were found. - Example: Asking a content with the right identifier format but that content does not exist. 
- exception swh.web.utils.exc.ForbiddenExc[source]#
- Bases: - PermissionDenied- Good request to the api, forbidden result to return due to enforce
- policy. 
 - Example: Asking for a raw content which exists but whose mimetype is not text. 
- exception swh.web.utils.exc.UnauthorizedExc[source]#
- Bases: - Exception- Request to Web API endpoint requires authentication. 
- exception swh.web.utils.exc.LargePayloadExc[source]#
- Bases: - Exception- The input size is too large. - Example: Asking to resolve 10000 SWHIDs when the limit is 1000. 
- swh.web.utils.exc.masked_to_common_types(exc: MaskedObjectException)[source]#
- Convert - exc.maskedto common types, suitable for JSON and YAML encoding.- ExtendedSWHID becomes strings and MaskedStatus becomes a dict. 
- swh.web.utils.exc.swh_handle400(request: HttpRequest, exception: Exception | None = None) HttpResponse[source]#
- Custom Django HTTP error 400 handler for swh-web. 
- swh.web.utils.exc.swh_handle403(request, exception: Exception | None = None) HttpResponse[source]#
- Custom Django HTTP error 403 handler for swh-web. 
- swh.web.utils.exc.swh_handle404(request, exception: Exception | None = None) HttpResponse[source]#
- Custom Django HTTP error 404 handler for swh-web.