SPy Notifications

class seeq.spy.notifications.EmailRecipient(email: str, name: Optional[str] = None)

Bases: object

seeq.spy.notifications.send_email(to: Union[str, seeq.spy.notifications._emails.EmailRecipient, List[Union[str, seeq.spy.notifications._emails.EmailRecipient]]], subject: str, content: str, *, cc: Optional[Union[str, seeq.spy.notifications._emails.EmailRecipient, List[Union[str, seeq.spy.notifications._emails.EmailRecipient]]]] = None, bcc: Optional[Union[str, seeq.spy.notifications._emails.EmailRecipient, List[Union[str, seeq.spy.notifications._emails.EmailRecipient]]]] = None, attachments: Optional[Union[seeq.spy.notifications._emails.EmailAttachment, List[seeq.spy.notifications._emails.EmailAttachment]]] = None, errors: Optional[str] = None, quiet: Optional[bool] = None, status: Optional[seeq.spy._status.Status] = None, session: Optional[seeq.spy._session.Session] = 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.

  • 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.


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"))