airflow.providers.amazon.aws.transfers.imap_attachment_to_s3

This module allows you to transfer mail attachments from a mail server into s3 bucket.

Module Contents

class airflow.providers.amazon.aws.transfers.imap_attachment_to_s3.ImapAttachmentToS3Operator(*, imap_attachment_name: str, s3_key: str, imap_check_regex: bool = False, imap_mail_folder: str = 'INBOX', imap_mail_filter: str = 'All', s3_overwrite: bool = False, imap_conn_id: str = 'imap_default', s3_conn_id: str = 'aws_default', **kwargs)[source]

Bases: airflow.models.BaseOperator

Transfers a mail attachment from a mail server into s3 bucket.

See also

For more information on how to use this operator, take a look at the guide: Imap Attachment To S3 Operator

Parameters
  • imap_attachment_name (str) -- The file name of the mail attachment that you want to transfer.

  • s3_key (str) -- The destination file name in the s3 bucket for the attachment.

  • imap_check_regex (bool) -- If set checks the imap_attachment_name for a regular expression.

  • imap_mail_folder (str) -- The folder on the mail server to look for the attachment.

  • imap_mail_filter (str) -- If set other than 'All' only specific mails will be checked. See imaplib.IMAP4.search() for details.

  • s3_overwrite (bool) -- If set overwrites the s3 key if already exists.

  • imap_conn_id (str) -- The reference to the connection details of the mail server.

  • s3_conn_id (str) -- The reference to the s3 connection details.

template_fields = ['imap_attachment_name', 's3_key', 'imap_mail_filter'][source]
execute(self, context)[source]

This function executes the transfer from the email server (via imap) into s3.

Parameters

context (dict) -- The context while executing.

Was this entry helpful?