Exceptions

exception py42.exceptions.Py42ActiveLegalHoldError(exception, resource, resource_id)

Bases: py42.exceptions.Py42BadRequestError

An exception raised when attempting to deactivate a user or device that is in an active legal hold.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42ArchiveFileNotFoundError(response, device_guid, file_path)

Bases: py42.exceptions.Py42ResponseError

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

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42BadRequestError(exception, message=None)

Bases: py42.exceptions.Py42HTTPError

A wrapper to represent an HTTP 400 error.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42BadRestoreRequestError(exception)

Bases: py42.exceptions.Py42BadRequestError

An error raised when the given restore arguments are not compatible and cause a bad request.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42CaseAlreadyHasEventError(exception)

Bases: py42.exceptions.Py42BadRequestError

An error raised when event is already associated to the case.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42CaseNameExistsError(exception, case_name)

Bases: py42.exceptions.Py42BadRequestError

An error raised when trying to create a case with a name that already exists.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42ChecksumNotFoundError(response, checksum_name, checksum_value)

Bases: py42.exceptions.Py42ResponseError

An exception raised when a user-supplied hash could not successfully locate its corresponding resource.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42CloudAliasLimitExceededError(exception, message=None)

Bases: py42.exceptions.Py42BadRequestError

An Exception raised when trying to add a cloud alias to a user when that user already has the max amount of supported cloud aliases.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42ConflictError(exception, message=None)

Bases: py42.exceptions.Py42HTTPError

A wrapper to represent an HTTP 409 error.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42DescriptionLimitExceededError(exception)

Bases: py42.exceptions.Py42BadRequestError

An error raised when description of a case exceeds the allowed char length limit.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42DeviceNotConnectedError(response, device_guid)

Bases: py42.exceptions.Py42ResponseError

An exception raised when trying to push a restore to a device that is not connected to an Authority server.

response

The response prior to the error.

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(response)

Bases: py42.exceptions.Py42ResponseError

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

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42ForbiddenError(exception, message=None)

Bases: py42.exceptions.Py42HTTPError

A wrapper to represent an HTTP 403 error.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42HTTPError(exception, message=None)

Bases: py42.exceptions.Py42ResponseError

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

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42InternalServerError(exception, message=None)

Bases: py42.exceptions.Py42HTTPError

A wrapper to represent an HTTP 500 error.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42InvalidArchiveEncryptionKey(exception)

Bases: py42.exceptions.Py42HTTPError

An exception raised the encryption key for an archive is invalid.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42InvalidArchivePassword(exception)

Bases: py42.exceptions.Py42HTTPError

An exception raised when the password for unlocking an archive is invalid.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42InvalidCaseUserError(exception, user_field)

Bases: py42.exceptions.Py42BadRequestError

An error raised when a case subject or assignee is not a valid user.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42InvalidEmailError(email, exception)

Bases: py42.exceptions.Py42InternalServerError

An exception raised when trying to set an invalid email as a user’s email.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42InvalidPageTokenError(exception, page_token)

Bases: py42.exceptions.Py42BadRequestError

An error raised when the page token given is invalid.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42InvalidPasswordError(exception)

Bases: py42.exceptions.Py42InternalServerError

An exception raised when trying to set an invalid password as a user’s password.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42InvalidRuleError(exception, rule_id)

Bases: py42.exceptions.Py42NotFoundError

An exception raised when the observer rule ID does not exist.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42InvalidRuleOperationError(exception, rule_id, source)

Bases: py42.exceptions.Py42HTTPError

An exception raised when trying to add or remove users to a system rule.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42InvalidUsernameError(exception)

Bases: py42.exceptions.Py42InternalServerError

An exception raised when trying to set an invalid username as a user’s username.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42LegalHoldCriteriaMissingError(exception)

Bases: py42.exceptions.Py42BadRequestError

An exception raised when a bad request was made to a Legal Hold endpoint.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42LegalHoldNotFoundOrPermissionDeniedError(exception, matter_id)

Bases: py42.exceptions.Py42ForbiddenError

An exception raised when a legal hold matter is inaccessible from your account or the matter ID is not valid.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42MFARequiredError(exception, message=None)

Bases: py42.exceptions.Py42UnauthorizedError

Deprecated: An exception raised when a request requires multi-factor authentication

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42NotFoundError(exception, message=None)

Bases: py42.exceptions.Py42HTTPError

A wrapper to represent an HTTP 404 error.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42OrgNotFoundError(exception, org_uid)

Bases: py42.exceptions.Py42BadRequestError

An exception raised when a 400 HTTP error message indicates that an organization was not found.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42ResponseError(response, message)

Bases: py42.exceptions.Py42Error

A base custom class to manage all errors raised because of an HTTP response.

response

The response prior to the error.

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 connection is invalid. A connection might be invalid due to connection timeout, invalid token, etc.

with_traceback()

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

exception py42.exceptions.Py42StorageSessionInitializationError(exception, error_message)

Bases: py42.exceptions.Py42HTTPError

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.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42TooManyRequestsError(exception, message=None)

Bases: py42.exceptions.Py42HTTPError

A wrapper to represent an HTTP 429 error.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42TrustedActivityConflictError(exception, value)

Bases: py42.exceptions.Py42ConflictError

An error raised when theres a conflict with a trusted activity domain URL.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42TrustedActivityIdNotFound(exception, resource_id)

Bases: py42.exceptions.Py42NotFoundError

An exception raised when the trusted activity ID does not exist.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42TrustedActivityInvalidChangeError(exception)

Bases: py42.exceptions.Py42BadRequestError

An error raised when an invalid change is being made to a trusted activity.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42TrustedActivityInvalidCharacterError(exception)

Bases: py42.exceptions.Py42BadRequestError

An error raised when an invalid character is in a trusted activity value.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42UnableToCreateProfileError(exception, username)

Bases: py42.exceptions.Py42BadRequestError

An error raised when trying to call the method for creating a detection-list user when the user does not exist or is currently awaiting the profile to get created on the back-end. Note: you are no longer able to create detection-list profiles using the API; py42 only returns already existing profiles.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42UnauthorizedError(exception, message=None)

Bases: py42.exceptions.Py42HTTPError

A wrapper to represent an HTTP 401 error.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42UpdateClosedCaseError(exception)

Bases: py42.exceptions.Py42BadRequestError

An error raised when trying to update a closed case.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42UserAlreadyAddedError(exception, user_id, list_name)

Bases: py42.exceptions.Py42BadRequestError

An exception raised when the user is already added to group or list, such as the Departing Employee list.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42UserAlreadyExistsError(exception, message=None)

Bases: py42.exceptions.Py42InternalServerError

An exception raised when a user already exists

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42UserNotOnListError(exception, user_id, list_name)

Bases: py42.exceptions.Py42NotFoundError

An exception raised when the user is not on a detection list.

response

The response prior to the error.

with_traceback()

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

exception py42.exceptions.Py42UsernameMustBeEmailError(exception)

Bases: py42.exceptions.Py42InternalServerError

An exception raised when trying to set a non-email as a user’s username in a cloud environment.

response

The response prior to the error.

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 HTTPError’s response status code.