airflow.providers.imap.sensors.imap_attachment

This module allows you to poke for attachments on a mail server.

Module Contents

Classes

ImapAttachmentSensor

Waits for a specific attachment on a mail server.

class airflow.providers.imap.sensors.imap_attachment.ImapAttachmentSensor(*, attachment_name, check_regex=False, mail_folder='INBOX', mail_filter='All', conn_id='imap_default', **kwargs)[source]

Bases: airflow.sensors.base.BaseSensorOperator

Waits for a specific attachment on a mail server.

Parameters
  • attachment_name – The name of the attachment that will be checked.

  • check_regex – If set to True the attachment’s name will be parsed as regular expression. Through this you can get a broader set of attachments that it will look for than just only the equality of the attachment name.

  • mail_folder – The mail folder in where to search for the attachment.

  • mail_filter – If set other than ‘All’ only specific mails will be checked. See imaplib.IMAP4.search() for details.

  • imap_conn_id – The imap connection id to run the sensor against.

template_fields: Sequence[str] = ('attachment_name', 'mail_filter')[source]
poke(context)[source]

Pokes for a mail attachment on the mail server.

Parameters

context (airflow.utils.context.Context) – The context that is being provided when poking.

Returns

True if attachment with the given name is present and False if not.

Return type

bool

Was this entry helpful?