notifications

eztaskmanager.services.notifications.get_base_url()[source]

Retrieve the base URL for the current site.

Returns:

The base URL for the current site.

Return type:

str

Raises:

None.

Examples

>>> get_base_url()
'example.com'
class eztaskmanager.services.notifications.NotificationHandler(level: int | str = 0)[source]

An abstract base class for handling notifications.

handle(report)[source]

Check the result of the report against the established lo level before emitting notifications.

abstract emit(report)[source]

Abstract method. To be implemented in concrete classes.

class eztaskmanager.services.notifications.SlackNotificationHandler(token, channel, level)[source]

This class is a notification handler that sends notifications to a specified Slack channel using the Slack API.

Params:

client (slack_sdk.WebClient): The Slack WebClient object used to interact with the Slack API. channel (str): The Slack channel to which the notifications will be sent. level (int): The log level at which notifications will be sent.

emit(report)[source]

Sends an email notification based on the given report.

emit(report)[source]

Send a Slack notification based on the given report’s result.

class eztaskmanager.services.notifications.EmailNotificationHandler(from_email, recipients, level)[source]

A class for handling email notifications.

Inherits from NotificationHandler.

from_email

The email address to use as the sender of the notification.

Type:

str

recipients

A list of email addresses to send the notification to.

Type:

list[str]

level

The level of the notification.

Type:

int

emit(report)[source]

Sends an email notification based on the given report.

emit(report)[source]

Send an email notification based on the given level.

eztaskmanager.services.notifications.emit_notifications(report)[source]

Emit notifications for the given report.

Parameters:

report – The report object containing the invocation result.

Returns:

None