Skip to content

Notification

This module contains classes for sending notifications.

ATTRIBUTE DESCRIPTION
FILENAME_TIME_FORMAT

time format for filenames

TYPE: str

CLASS DESCRIPTION
Notifier

class for sending notifications

EmailNotifier

class for sending email notifications

Documentation last updated: 2025-06-11

EmailNotifier

EmailNotifier(configs: dict)

Bases: Notifier

EmailNotifier class for sending email notifications. Use the EmailNotifier class as context manager to handle app passwords securely.

ATTRIBUTE DESCRIPTION
configs

configuration details for the notifier

TYPE: dict

METHOD DESCRIPTION
fromFile

create a Notifier object from a configuration file

writeMessage

write a message

writeEmail

write an email message

notify

write and send a message through chosen service

sendMessage

send a message through chosen service

sendEmail

send an email message through chosen server

sendEmail

sendEmail(
    service_config: dict,
    username: str,
    message: EmailMessage,
)

Send an email message through chosen server

PARAMETER DESCRIPTION
service_config

configuration details for the service

TYPE: dict

username

username for the service

TYPE: str

message

email message to be sent

TYPE: EmailMessage

writeEmail classmethod

writeEmail(
    message_config: dict,
    placeholders: dict | None = None,
    *args,
    attachments: Iterable[Path] | None = None,
    save_zip: bool = False,
    time_format: str = "%Y-%m-%d %H:%M:%S",
    **kwargs,
) -> EmailMessage

Write an email message

PARAMETER DESCRIPTION
message_config

configuration details for the message

TYPE: dict

placeholders

placeholders for the message

TYPE: dict DEFAULT: None

attachments

filepaths of attachments to be sent

TYPE: Iterable[Path] DEFAULT: None

save_zip

whether to save the attachments as a zip file

TYPE: bool DEFAULT: False

time_format

time format for the message

TYPE: str DEFAULT: '%Y-%m-%d %H:%M:%S'

RETURNS DESCRIPTION
EmailMessage

EmailMessage: email message to be sent

Notifier

Notifier(configs: dict)

Notifier class for sending notifications. Use the Notifier class as context manager to handle app passwords securely.

ATTRIBUTE DESCRIPTION
configs

configuration details for the notifier

TYPE: dict

METHOD DESCRIPTION
fromFile

create a Notifier object from a configuration file

writeMessage

write a message

notify

write and send a message through chosen service

sendMessage

send a message through chosen service

Initialize Notifier class

PARAMETER DESCRIPTION
configs

configuration details for the notifier

TYPE: dict

fromFile classmethod

fromFile(config_file: str | Path) -> Notifier

Create a Notifier object from a configuration file

PARAMETER DESCRIPTION
config_file

Path to the configuration file

TYPE: str | Path

RETURNS DESCRIPTION
Notifier

Notifier object created from the configuration file

TYPE: Notifier

notify

notify(placeholders: dict | None = None, **kwargs)

Write and send a message through chosen service

PARAMETER DESCRIPTION
placeholders

placeholders for the message

TYPE: dict DEFAULT: None

sendMessage

sendMessage(
    service_config: dict, username: str, message: Any
)

Send a message through chosen service

PARAMETER DESCRIPTION
service_config

configuration details for the service

TYPE: dict

username

username for the service

TYPE: str

message

message to be sent

TYPE: Any

writeMessage classmethod

writeMessage(
    message_config: dict,
    placeholders: dict | None = None,
    *args,
    **kwargs,
) -> Any

Write a message

PARAMETER DESCRIPTION
message_config

configuration details for the message

TYPE: dict

placeholders

placeholders for the message

TYPE: dict DEFAULT: None

RETURNS DESCRIPTION
Any

message to be sent

TYPE: Any