Exceptions Reference

This module includes code used for handling and raising exceptions within pypiwrap.

exception pypiwrap.exceptions.ClientError(status: int, reason: str)

Raised when an error occurs while performing a request.

exception pypiwrap.exceptions.NotFound(status: int, reason: str)

Raised when a project, release, or file was not found.

exception pypiwrap.exceptions.ParseError

Raised when an error occurs while parsing a response.

Added in version 2.0.0.

exception pypiwrap.exceptions.UnexpectedVersionWarning

Emitted when a response specifies a minor version greater than the one expected.

Added in version 2.0.0.

exception pypiwrap.exceptions.UnsupportedVersionError

Raised when a response specifies a major version greater than the one supported.

Added in version 2.0.0.

pypiwrap.exceptions.raise_for_status(response: Response, messages: dict[int, str] | None = None) None

Raises an exception based on the response’s status code. If the status code is deemed OK, this will do nothing.

Parameters:
  • response (requests.Response) – The response itself.

  • messages (dict[int, str], optional) – A mapping of status codes to messages.