SPy Notifications

class seeq.spy.notifications.EmailRecipient(email: str, name: str | None = None)

Bases: object

seeq.spy.notifications.send_email(to: str | EmailRecipient | List[str | EmailRecipient], subject: str, content: str, *, cc: str | EmailRecipient | List[str | EmailRecipient] | None = None, bcc: str | EmailRecipient | List[str | EmailRecipient] | None = None, attachments: EmailAttachment | List[EmailAttachment] | None = None, errors: str | None = None, quiet: bool | None = None, status: Status | None = None, session: Session | None = None) None

Sends an email notification. The number of recipients (to + cc + bcc) cannot be greater than 50 to avoid spam. This limit may vary depending on the system configuration. The email sending is rate limited per user and per Seeq server.

Parameters:
  • to (str, EmailRecipient, List[str or EmailRecipient]) – The email recipients list. It is mandatory to have at least one recipient.

  • subject (str) – The email subject, mandatory value.

  • content (str) – The email content, mandatory value. The content supports basic HTML tags.

  • cc (str, EmailRecipient, List[str or EmailRecipient], default None) – Carbon Copy recipients list

  • bcc (str, EmailRecipient, List[str or EmailRecipient], default None) – Blank Carbon Copy recipients list

  • attachments (EmailAttachment, List[EmailAttachment], default None) – Attachments to be sent with the email.

  • errors ({'raise', 'catalog'}, default 'raise') – If ‘raise’, any errors encountered will cause an exception. If ‘catalog’, errors will be added to a ‘Result’ column in the status.df DataFrame.

  • quiet (bool, default False) – If True, suppresses output. Note that when status is provided, the quiet setting of the Status object that is passed in takes precedence.

  • status (spy.Status, optional) – If specified, the supplied Status object will be updated as the command progresses. It gets filled in with the same information you would see in Jupyter in the blue/green/red table below your code while the command is executed. The table itself is accessible as a DataFrame via the status.df property.

  • session (spy.Session, optional) – If supplied, the Session object (and its Options) will be used to store the login session state. This is useful to log in to different Seeq servers at the same time or with different credentials.

Examples

Simple usage:

>>> spy.notifications.send_email('test@seeq.com', 'Subject', 'Content')

A more complex example:

>>> from seeq.spy.notifications import send_email, EmailRecipient
>>> send_email(to=[
>>>                 'test@seeq.com',
>>>                 EmailRecipient(name='Test Name', email='test.name@seeq.com')
>>>               ],
>>>            cc="some_user@seeq.com",
>>>            bcc=['bcc.recipient@seeq.com', 'another.bcc@seeq.com'],
>>>            subject='Subject',
>>>            content='Email content')

An example with an attachment:

>>> import base64
>>> from seeq.spy.notifications import send_email, EmailAttachment
>>> send_email(to="test@seeq.com",
>>>            subject="Email with attachment",
>>>            content="See attachment",
>>>            attachments=EmailAttachment(content=base64.b64encode(b"My message attachment").decode("ascii"),
>>>                                        type="text/plain",
>>>                                        filename="attachment.txt"))