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

Classes

ImapAttachmentToS3Operator

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

class airflow.providers.amazon.aws.transfers.imap_attachment_to_s3.ImapAttachmentToS3Operator(*, imap_attachment_name, s3_bucket, s3_key, imap_check_regex=False, imap_mail_folder='INBOX', imap_mail_filter='All', s3_overwrite=False, imap_conn_id='imap_default', s3_conn_id=None, aws_conn_id='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 Amazon S3 transfer operator

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

  • s3_bucket (str) – The targeted s3 bucket. This is the S3 bucket where the file will be downloaded.

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

  • aws_conn_id (str) – AWS connection to use.

template_fields :Sequence[str] = ['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 (airflow.utils.context.Context) – The context while executing.

Was this entry helpful?