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.
- property resource
The user or device resource.
- property resource_id
The resource ID.
- property 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.
- property device_guid
The device GUID provided.
- property file_path
The file path provided.
- property 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, *args)
Bases:
py42.exceptions.Py42HTTPError
A wrapper to represent an HTTP 400 error.
- property 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.
- property 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.
- property 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.
- property case_name
The case name.
- property 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.
- property checksum_name
The checksum name.
- property checksum_value
The checksum value.
- property response
The response prior to the error.
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception py42.exceptions.Py42CloudAliasCharacterLimitExceededError
Bases:
py42.exceptions.Py42Error
An exception raised when trying to add a cloud alias to a user that exceeds the max character limit.
- 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.
- property 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, *args)
Bases:
py42.exceptions.Py42HTTPError
A wrapper to represent an HTTP 409 error.
- property 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.
- property 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.
- property device_guid
The device GUID.
- property 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.
Bases:
py42.exceptions.Py42ResponseError
An exception raised when a requested feature is not supported in your Code42 environment.
The response prior to the error.
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception py42.exceptions.Py42ForbiddenError(exception, message=None, *args)
Bases:
py42.exceptions.Py42HTTPError
A wrapper to represent an HTTP 403 error.
- property 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, *args)
Bases:
py42.exceptions.Py42ResponseError
A base custom class to manage all HTTP errors raised by an API endpoint.
- property 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, *args)
Bases:
py42.exceptions.Py42HTTPError
A wrapper to represent an HTTP 500 error.
- property 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.
- property 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.
- property 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_uid)
Bases:
py42.exceptions.Py42BadRequestError
An error raised when a case subject or assignee is not a valid user.
- property response
The response prior to the error.
- property user
The user UID.
- 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.
- property email
The email being assigned to a user.
- property 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.
- property page_token
The page token.
- property 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.
- property 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.
- property response
The response prior to the error.
- property rule_id
The observer rule ID.
- 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.
- property response
The response prior to the error.
- property rule_id
The rule ID.
- property source
The rule source.
- 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.
- property response
The response prior to the error.
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception py42.exceptions.Py42InvalidWatchlistType(exception, watchlist_type)
Bases:
py42.exceptions.Py42BadRequestError
An exception raised when an invalid watchlist type is specified.
- property response
The response prior to the error.
- property watchlist_type
The specified watchlist type.
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception py42.exceptions.Py42LegalHoldAlreadyActiveError(exception, legal_hold_matter_uid)
Bases:
py42.exceptions.Py42BadRequestError
An exception raised when trying to activate a Legal Hold Matter that is already active.
- property legal_hold_matter_uid
The legal hold matter UID.
- property response
The response prior to the error.
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception py42.exceptions.Py42LegalHoldAlreadyDeactivatedError(exception, legal_hold_matter_uid)
Bases:
py42.exceptions.Py42BadRequestError
An exception raised when trying to deactivate a Legal Hold Matter that is already inactive.
- property legal_hold_matter_uid
The legal hold matter UID.
- property 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.
- property 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, resource_uid, legal_hold_resource='matter')
Bases:
py42.exceptions.Py42ForbiddenError
An exception raised when a legal hold matter is inaccessible from your account or the matter UID is not valid.
- property response
The response prior to the error.
- property uid
The UID of the legal hold resource.
- 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
- property 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, *args)
Bases:
py42.exceptions.Py42HTTPError
A wrapper to represent an HTTP 404 error.
- property 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.
- property org_uid
” The org UID.
- property 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, *args)
Bases:
py42.exceptions.Py42Error
A base custom class to manage all errors raised because of an HTTP response.
- property 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, 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.
- property 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, *args)
Bases:
py42.exceptions.Py42HTTPError
A wrapper to represent an HTTP 429 error.
- property 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.
- property response
The response prior to the error.
- property value
The domain, URL or workspace name.
- 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.
- property resource_id
The resource ID.
- property 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.
- property 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.
- property 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.
- property response
The response prior to the error.
- property username
The username of the user.
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception py42.exceptions.Py42UnauthorizedError(exception, message=None, *args)
Bases:
py42.exceptions.Py42HTTPError
A wrapper to represent an HTTP 401 error.
- property 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.
- property 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.
- property response
The response prior to the error.
- property user_id
The user ID.
- 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
- property 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.
- property list_name
The list name.
- property response
The response prior to the error.
- property user_id
The user ID.
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception py42.exceptions.Py42UserRiskProfileNotFound(exception, user_id, identifier='ID')
Bases:
py42.exceptions.Py42NotFoundError
An exception raised when the user with the given ID for a user risk profile was not found.
- property response
The response prior to the error.
- property user
The user identifier.
- 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.
- property response
The response prior to the error.
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception py42.exceptions.Py42WatchlistNotFound(exception, resource_id)
Bases:
py42.exceptions.Py42NotFoundError
An exception raised when the watchlist with the given ID was not found.
- property response
The response prior to the error.
- property watchlist_id
The watchlist ID.
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception py42.exceptions.Py42WatchlistOrUserNotFound(exception, watchlist_id, user_id)
Bases:
py42.exceptions.Py42NotFoundError
An exception raised when the watchlist ID or the User ID does not exist.
- property response
The response prior to the error.
- property user_id
The user ID.
- property watchlist_id
The watchlist ID.
- 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.