Exceptions

exception py42.exceptions.Py42ArchiveFileNotFoundError(device_guid, file_path)

Bases: py42.exceptions.Py42Error

An exception raised when a resource file is not found or the path is invalid.

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception py42.exceptions.Py42BadRequestError(exception)

Bases: py42.exceptions.Py42HTTPError

A wrapper to represent an HTTP 400 error.

property response

The response object containing the HTTP error details.

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception py42.exceptions.Py42Error

Bases: Exception

A generic, Py42 custom base exception.

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception py42.exceptions.Py42FeatureUnavailableError

Bases: py42.exceptions.Py42Error

An exception raised when a requested feature is not supported in your Code42 environment.

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception py42.exceptions.Py42ForbiddenError(exception)

Bases: py42.exceptions.Py42HTTPError

A wrapper to represent an HTTP 403 error.

property response

The response object containing the HTTP error details.

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception py42.exceptions.Py42HTTPError(exception)

Bases: py42.exceptions.Py42Error

A base custom class to manage all HTTP errors raised by an API endpoint.

property response

The response object containing the HTTP error details.

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception py42.exceptions.Py42InternalServerError(exception)

Bases: py42.exceptions.Py42HTTPError

A wrapper to represent an HTTP 500 error.

property response

The response object containing the HTTP error details.

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception py42.exceptions.Py42NotFoundError(exception)

Bases: py42.exceptions.Py42HTTPError

A wrapper to represent an HTTP 404 error.

property response

The response object containing the HTTP error details.

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception py42.exceptions.Py42SecurityPlanConnectionError(error_message)

Bases: py42.exceptions.Py42Error

An exception raised when the user is not authorized to access the requested resource.

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception py42.exceptions.Py42SessionInitializationError(exception)

Bases: py42.exceptions.Py42Error

An exception raised when a user session is invalid. A session might be invalid due to session timeout, invalid token, etc.

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception py42.exceptions.Py42StorageSessionInitializationError(error_message)

Bases: py42.exceptions.Py42Error

An exception raised when the user is not authorized to initialize a storage session. This may occur when trying to restore a file or trying to get events for file activity on removable media, in cloud sync folders, and browser uploads.

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception py42.exceptions.Py42UnauthorizedError(exception)

Bases: py42.exceptions.Py42HTTPError

A wrapper to represent an HTTP 401 error.

property response

The response object containing the HTTP error details.

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

py42.exceptions.raise_py42_error(raised_error)

Raises the appropriate py42.exceptions.Py42HttpError based on the given error’s response status code.