msticpy.common.exceptions module

Miscellaneous helper methods for Jupyter Notebooks.

exception msticpy.common.exceptions.MsticpyAzureConfigError(*args, help_uri: Tuple[str, str] | str | None = None, **kwargs)

Bases: MsticpyUserConfigError

Exception class for AzureData.

Create Azure data missing configuration exception.

Parameters:

help_uri (Union[Tuple[str, str], str, None], optional) – Override the default help URI.

DEF_HELP_URI = ('Using the Azure API connector', 'https://msticpy.readthedocs.io/en/latest/data_acquisition/AzureData.html#instantiating-and-connecting-with-an-azure-data-connector')
args
display_exception()

Output the exception HTML or text friendly exception.

property help_uri: Tuple[str, str] | str

Get the default help URI.

classmethod no_display_exceptions()

Context manager to block exception display to IPython/stdout.

with_traceback()

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

exception msticpy.common.exceptions.MsticpyAzureConnectionError(*args, help_uri: Tuple[str, str] | str | None = None, **kwargs)

Bases: MsticpyUserError

Exception class for Azure Connection errors.

Create an instance of the MsticpyUserError class.

Parameters:
  • args (Iterable of strings) – Args will be printed as text of the exception.

  • help_uri (Union[Tuple[str, str], str, None], optional) – Primary URL, by default “https://msticpy.readthedocs.org

  • title (str, optional) – If a title keyword argument is supplied it will be used to create the title line.

  • *_uri (str, optional) – Additional keyword arguments who’s names end in “_uri” will be used to create a list of references in addition to the primary help_uri

  • display (bool, optional) – Display the exception when created. By default, False

Notes

The exception text is displayed when the exception is created and not when it is raised. We recommend creating the exception within the raise statement. E.g.

raise MsticpyUserException(arg1, arg2…)

Developer note: Any classes derived from MsticpyUserError should be named with an “Error” suffix to distinguish these from standard exception types.

DEF_HELP_URI = ('Connecting to Microsoft Sentinel', 'https://msticpy.readthedocs.io/en/latest/data_acquisition/AzureData.html#instantiating-and-connecting-with-an-azure-data-connector')
args
display_exception()

Output the exception HTML or text friendly exception.

property help_uri: Tuple[str, str] | str

Get the default help URI.

classmethod no_display_exceptions()

Context manager to block exception display to IPython/stdout.

with_traceback()

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

exception msticpy.common.exceptions.MsticpyConfigError

Bases: MsticpyException

Configuration exception class for msticpy.

args
with_traceback()

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

exception msticpy.common.exceptions.MsticpyConnectionError(*args, help_uri: Tuple[str, str] | str | None = None, **kwargs)

Bases: MsticpyUserError

Exception class for KqlConnection errors.

Create an instance of the MsticpyUserError class.

Parameters:
  • args (Iterable of strings) – Args will be printed as text of the exception.

  • help_uri (Union[Tuple[str, str], str, None], optional) – Primary URL, by default “https://msticpy.readthedocs.org

  • title (str, optional) – If a title keyword argument is supplied it will be used to create the title line.

  • *_uri (str, optional) – Additional keyword arguments who’s names end in “_uri” will be used to create a list of references in addition to the primary help_uri

  • display (bool, optional) – Display the exception when created. By default, False

Notes

The exception text is displayed when the exception is created and not when it is raised. We recommend creating the exception within the raise statement. E.g.

raise MsticpyUserException(arg1, arg2…)

Developer note: Any classes derived from MsticpyUserError should be named with an “Error” suffix to distinguish these from standard exception types.

DEF_HELP_URI = ('DataProviders', 'https://msticpy.readthedocs.io/en/latest/data_acquisition/DataProviders.html')
args
display_exception()

Output the exception HTML or text friendly exception.

property help_uri: Tuple[str, str] | str

Get the default help URI.

classmethod no_display_exceptions()

Context manager to block exception display to IPython/stdout.

with_traceback()

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

exception msticpy.common.exceptions.MsticpyDataQueryError(*args, help_uri: Tuple[str, str] | str | None = None, **kwargs)

Bases: MsticpyUserError

Exception class for data query errors.

Create an instance of the MsticpyUserError class.

Parameters:
  • args (Iterable of strings) – Args will be printed as text of the exception.

  • help_uri (Union[Tuple[str, str], str, None], optional) – Primary URL, by default “https://msticpy.readthedocs.org

  • title (str, optional) – If a title keyword argument is supplied it will be used to create the title line.

  • *_uri (str, optional) – Additional keyword arguments who’s names end in “_uri” will be used to create a list of references in addition to the primary help_uri

  • display (bool, optional) – Display the exception when created. By default, False

Notes

The exception text is displayed when the exception is created and not when it is raised. We recommend creating the exception within the raise statement. E.g.

raise MsticpyUserException(arg1, arg2…)

Developer note: Any classes derived from MsticpyUserError should be named with an “Error” suffix to distinguish these from standard exception types.

DEF_HELP_URI = ('Query failed', 'https://msticpy.readthedocs.io/en/latest/DataAcquisition.html#querying-and-importing-data')
args
display_exception()

Output the exception HTML or text friendly exception.

property help_uri: Tuple[str, str] | str

Get the default help URI.

classmethod no_display_exceptions()

Context manager to block exception display to IPython/stdout.

with_traceback()

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

exception msticpy.common.exceptions.MsticpyException

Bases: Exception

Default exception class for msticpy.

args
with_traceback()

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

exception msticpy.common.exceptions.MsticpyImportExtraError(*args, help_uri: Tuple[str, str] | str | None = None, **kwargs)

Bases: MsticpyUserError, ImportError

Exception class for Imports that need an extra.

Create import missing extra exception.

Parameters:
  • help_uri (Union[Tuple[str, str], str, None], optional) – Override the default help URI.

  • extra (str) – The name of the setup extra that needs to be installed.

DEF_HELP_URI = ('Installing msticpy', 'https://msticpy.readthedocs.io/en/latest/getting_started/Installing.html')
args
display_exception()

Output the exception HTML or text friendly exception.

property help_uri: Tuple[str, str] | str

Get the default help URI.

msg

exception message

name

module name

classmethod no_display_exceptions()

Context manager to block exception display to IPython/stdout.

path

module path

with_traceback()

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

exception msticpy.common.exceptions.MsticpyKeyVaultConfigError(*args, help_uri: Tuple[str, str] | str | None = None, **kwargs)

Bases: MsticpyUserConfigError

Key Vault configuration exception.

Create Key Vault configuration exception.

Parameters:

help_uri (Union[Tuple[str, str], str, None], optional) – Override the default help URI.

DEF_HELP_URI = ('Using keyvault to store msticpy secrets', 'https://msticpy.readthedocs.io/en/latest/getting_started/msticpyconfig.html#specifying-secrets-as-key-vault-secrets')
args
display_exception()

Output the exception HTML or text friendly exception.

property help_uri: Tuple[str, str] | str

Get the default help URI.

classmethod no_display_exceptions()

Context manager to block exception display to IPython/stdout.

with_traceback()

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

exception msticpy.common.exceptions.MsticpyKeyVaultMissingSecretError(*args, help_uri: Tuple[str, str] | str | None = None, **kwargs)

Bases: MsticpyKeyVaultConfigError

Missing secret exception.

Create Key Vault missing key exception.

Parameters:

help_uri (Union[Tuple[str, str], str, None], optional) – Override the default help URI.

DEF_HELP_URI = ('Using keyvault to store msticpy secrets', 'https://msticpy.readthedocs.io/en/latest/getting_started/msticpyconfig.html#specifying-secrets-as-key-vault-secrets')
args
display_exception()

Output the exception HTML or text friendly exception.

property help_uri: Tuple[str, str] | str

Get the default help URI.

classmethod no_display_exceptions()

Context manager to block exception display to IPython/stdout.

with_traceback()

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

exception msticpy.common.exceptions.MsticpyKqlConnectionError(*args, help_uri: Tuple[str, str] | str | None = None, **kwargs)

Bases: MsticpyUserError

Exception class for KqlConnection errors.

Create an instance of the MsticpyUserError class.

Parameters:
  • args (Iterable of strings) – Args will be printed as text of the exception.

  • help_uri (Union[Tuple[str, str], str, None], optional) – Primary URL, by default “https://msticpy.readthedocs.org

  • title (str, optional) – If a title keyword argument is supplied it will be used to create the title line.

  • *_uri (str, optional) – Additional keyword arguments who’s names end in “_uri” will be used to create a list of references in addition to the primary help_uri

  • display (bool, optional) – Display the exception when created. By default, False

Notes

The exception text is displayed when the exception is created and not when it is raised. We recommend creating the exception within the raise statement. E.g.

raise MsticpyUserException(arg1, arg2…)

Developer note: Any classes derived from MsticpyUserError should be named with an “Error” suffix to distinguish these from standard exception types.

DEF_HELP_URI = ('Connecting to Microsoft Sentinel', 'https://msticpy.readthedocs.io/en/latest/data_acquisition/DataProviders.html#connecting-to-an-azure-sentinel-workspace')
args
display_exception()

Output the exception HTML or text friendly exception.

property help_uri: Tuple[str, str] | str

Get the default help URI.

classmethod no_display_exceptions()

Context manager to block exception display to IPython/stdout.

with_traceback()

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

exception msticpy.common.exceptions.MsticpyMissingDependencyError(*args, help_uri: Tuple[str, str] | str | None = None, **kwargs)

Bases: MsticpyUserError, ImportError

Exception class for Imports that are not installed.

Create import missing extra exception.

Parameters:
  • help_uri (Union[Tuple[str, str], str, None], optional) – Override the default help URI.

  • packages (Union[str, List[str]]) – The name of the packages or list of packages that need(s) to be installed.

DEF_HELP_URI = ('Installing msticpy', 'https://msticpy.readthedocs.io/en/latest/getting_started/Installing.html')
args
display_exception()

Output the exception HTML or text friendly exception.

property help_uri: Tuple[str, str] | str

Get the default help URI.

msg

exception message

name

module name

classmethod no_display_exceptions()

Context manager to block exception display to IPython/stdout.

path

module path

with_traceback()

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

exception msticpy.common.exceptions.MsticpyNoDataSourceError(*args, help_uri: Tuple[str, str] | str | None = None, **kwargs)

Bases: MsticpyUserError

Exception class for missing data source errors.

Create an instance of the MsticpyUserError class.

Parameters:
  • args (Iterable of strings) – Args will be printed as text of the exception.

  • help_uri (Union[Tuple[str, str], str, None], optional) – Primary URL, by default “https://msticpy.readthedocs.org

  • title (str, optional) – If a title keyword argument is supplied it will be used to create the title line.

  • *_uri (str, optional) – Additional keyword arguments who’s names end in “_uri” will be used to create a list of references in addition to the primary help_uri

  • display (bool, optional) – Display the exception when created. By default, False

Notes

The exception text is displayed when the exception is created and not when it is raised. We recommend creating the exception within the raise statement. E.g.

raise MsticpyUserException(arg1, arg2…)

Developer note: Any classes derived from MsticpyUserError should be named with an “Error” suffix to distinguish these from standard exception types.

DEF_HELP_URI = ('Querying and importing data', 'https://msticpy.readthedocs.io/en/latest/DataAcquisition.html#querying-and-importing-data')
args
display_exception()

Output the exception HTML or text friendly exception.

property help_uri: Tuple[str, str] | str

Get the default help URI.

classmethod no_display_exceptions()

Context manager to block exception display to IPython/stdout.

with_traceback()

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

exception msticpy.common.exceptions.MsticpyNotConnectedError(*args, help_uri: Tuple[str, str] | str | None = None, **kwargs)

Bases: MsticpyUserError

Exception class for NotConnected errors.

Create an instance of the MsticpyUserError class.

Parameters:
  • args (Iterable of strings) – Args will be printed as text of the exception.

  • help_uri (Union[Tuple[str, str], str, None], optional) – Primary URL, by default “https://msticpy.readthedocs.org

  • title (str, optional) – If a title keyword argument is supplied it will be used to create the title line.

  • *_uri (str, optional) – Additional keyword arguments who’s names end in “_uri” will be used to create a list of references in addition to the primary help_uri

  • display (bool, optional) – Display the exception when created. By default, False

Notes

The exception text is displayed when the exception is created and not when it is raised. We recommend creating the exception within the raise statement. E.g.

raise MsticpyUserException(arg1, arg2…)

Developer note: Any classes derived from MsticpyUserError should be named with an “Error” suffix to distinguish these from standard exception types.

DEF_HELP_URI = ('Querying and importing data', 'https://msticpy.readthedocs.io/en/latest/DataAcquisition.html#querying-and-importing-data')
args
display_exception()

Output the exception HTML or text friendly exception.

property help_uri: Tuple[str, str] | str

Get the default help URI.

classmethod no_display_exceptions()

Context manager to block exception display to IPython/stdout.

with_traceback()

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

exception msticpy.common.exceptions.MsticpyParameterError(*args, help_uri: Tuple[str, str] | str | None = None, **kwargs)

Bases: MsticpyUserError

Exception class for missing/incorrect parameters.

Create parameter exception.

Parameters:
  • help_uri (Union[Tuple[str, str], str, None], optional) – Override the default help URI.

  • parameters (Union[str, List[str]) – The name of the bad parameter(s).

DEF_HELP_URI = ('MSTICPy documentation', 'https://msticpy.readthedocs.io')
args
display_exception()

Output the exception HTML or text friendly exception.

property help_uri: Tuple[str, str] | str

Get the default help URI.

classmethod no_display_exceptions()

Context manager to block exception display to IPython/stdout.

with_traceback()

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

exception msticpy.common.exceptions.MsticpyResourceError

Bases: MsticpyException

Exception class for resource errors.

args
with_traceback()

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

exception msticpy.common.exceptions.MsticpyUserConfigError(*args, help_uri: Tuple[str, str] | str | None = None, **kwargs)

Bases: MsticpyUserError

Configuration user exception class for msticpy.

Create generic user configuration exception.

Parameters:

help_uri (Union[Tuple[str, str], str, None], optional) – Override the default help URI.

DEF_HELP_URI = ('Configuring msticpy', 'https://msticpy.readthedocs.io/en/latest/getting_started/msticpyconfig.html')
args
display_exception()

Output the exception HTML or text friendly exception.

property help_uri: Tuple[str, str] | str

Get the default help URI.

classmethod no_display_exceptions()

Context manager to block exception display to IPython/stdout.

with_traceback()

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

exception msticpy.common.exceptions.MsticpyUserError(*args, help_uri: Tuple[str, str] | str | None = None, **kwargs)

Bases: MsticpyException

Msticpy User exception displaying friendly message.

Create an instance of the MsticpyUserError class.

Parameters:
  • args (Iterable of strings) – Args will be printed as text of the exception.

  • help_uri (Union[Tuple[str, str], str, None], optional) – Primary URL, by default “https://msticpy.readthedocs.org

  • title (str, optional) – If a title keyword argument is supplied it will be used to create the title line.

  • *_uri (str, optional) – Additional keyword arguments who’s names end in “_uri” will be used to create a list of references in addition to the primary help_uri

  • display (bool, optional) – Display the exception when created. By default, False

Notes

The exception text is displayed when the exception is created and not when it is raised. We recommend creating the exception within the raise statement. E.g.

raise MsticpyUserException(arg1, arg2…)

Developer note: Any classes derived from MsticpyUserError should be named with an “Error” suffix to distinguish these from standard exception types.

DEF_HELP_URI = ('msticpy documentation', 'https://msticpy.readthedocs.org')
args
display_exception()

Output the exception HTML or text friendly exception.

property help_uri: Tuple[str, str] | str

Get the default help URI.

classmethod no_display_exceptions()

Context manager to block exception display to IPython/stdout.

with_traceback()

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