airflow.contrib.sensors.imap_attachment_sensor

Module Contents

class airflow.contrib.sensors.imap_attachment_sensor.ImapAttachmentSensor(attachment_name, mail_folder='INBOX', check_regex=False, conn_id='imap_default', *args, **kwargs)[source]

Bases:airflow.sensors.base_sensor_operator.BaseSensorOperator

Waits for a specific attachment on a mail server.

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

  • check_regex (bool) – 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. The default value is False.

  • mail_folder (str) – The mail folder in where to search for the attachment. The default value is ‘INBOX’.

  • conn_id (str) – The connection to run the sensor against. The default value is ‘imap_default’.

template_fields = ['attachment_name'][source]
poke(self, context)[source]

Pokes for a mail attachment on the mail server.

Parameters

context (dict) – 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