types
Defines all types, base classes, and dataclasses used in the package.
Classes
Abstract base class for all messengers. |
|
Dataclass that holds all secrets needed for messengers. |
|
Dataclass that holds information about a task. |
- class Secrets(webhook_url='', smtp_server='', smtp_port=-1, smtp_starttls=True, smtp_user='', smtp_password='')[source]
Bases:
object
Dataclass that holds all secrets needed for messengers.
- Parameters:
webhook_url (str) – A string containing the webhook url for a Discord messenger.
smtp_server (str) – A string containing the smtp server for an email messenger.
smtp_port (int) – An integer containing the smtp port for an email messenger.
smtp_starttls (bool) – Boolean indicating whether to use starttls for an emails.
smtp_user (str) – A string containing the username for an email messenger.
smtp_password (str) – A string containing the password for an email messenger.
- __init__(webhook_url='', smtp_server='', smtp_port=-1, smtp_starttls=True, smtp_user='', smtp_password='')
- Parameters:
webhook_url (str) –
smtp_server (str) –
smtp_port (int) –
smtp_starttls (bool) –
smtp_user (str) –
smtp_password (str) –
- Return type:
None
- class TaskInfo(name='', message=None, send_result=False, send_function=False, send_args=True, args=(), kwargs=<factory>, result='', header='', has_errored=False)[source]
Bases:
object
Dataclass that holds information about a task.
An instance of this class is passed to the notify method of all messengers. If creating a custom messenger, you can use these fields to construct a notification message.
- Parameters:
name (str) – A string containing the name of the function being run.
message (str | None) – A string containing a custom message to be sent.
send_result (bool) – Boolean indicating whether results should be sent.
send_function (bool) – Boolean indicating whether calling function should be sent.
send_args (bool) – Boolean indicating whether args and kwargs should be sent.
args (tuple) – Tuple containing the arguments passed to the function.
kwargs (dict) – Dictionary containing the keyword arguments passed to the function.
result (str) – A string containing the return result of the function, or the traceback.
header (str) – A string containing a summary line for the notification header.
has_errored (bool) – A boolean indicating whether the function raised an exception.
- __init__(name='', message=None, send_result=False, send_function=False, send_args=True, args=(), kwargs=<factory>, result='', header='', has_errored=False)
- Parameters:
name (str) –
message (str | None) –
send_result (bool) –
send_function (bool) –
send_args (bool) –
args (tuple) –
kwargs (dict) –
result (str) –
header (str) –
has_errored (bool) –
- Return type:
None
- class Messenger[source]
Bases:
ABC
Abstract base class for all messengers.