Git Product home page Git Product logo

mailgun_plugin's Introduction

Airflow Mailgun Plugin

Maintainability

Test Coverage

An Airflow hook and operator to validate a list of emails using the Mailgun Email Validation API.

An example Mailgun validation DAG is available as well.

Setup

In the root of your Airflow project run:

$ pip install -U git+https://github.com/airflow-plugins/[email protected]

Quickstart

  1. Create an S3 bucket my_bucket on AWS or use an existing one.
  2. Upload a list of contacts contacts.json to it which consists of newline-delimited JSON (ndjson):
{"id": 123, "email": "[email protected]"}
{"id": 456, "email": "[email protected]"}
{"id": 96, "email": "[email protected]"}
{"id": 433, "email": "Real Person <[email protected]>"}
  1. Create an S3 connection in Airflow:
- Conn Id: aws_s3
- Conn type: S3
- Login: <AWS Access Key ID>
- Password: <AWS Secret Access Key>
  1. Create a Mailgun connection in Airflow:
- Conn Id: mailgun_api
- Conn type: (empty)
- Login: <Mailgun Public Validation Key>
  1. Add a task to your DAG like:
dag = DAG(...)

email_validator = EmailValidationOperator(
    task_id='email_validator',
    mailgun_conn_id='mailgun_api',
    aws_conn_id='aws_s3',
    s3_bucket_name='my_bucket',
    s3_key_source='contacts.json',
    dag=dag,
)

Notes

Mailgun Email Validation Pricing

Your first 100 email validations per month are free; beyond that, see the Mailgun Pricing page.

Test

Install:

$ git clone https://github.com/airflow-plugins/mailgun_plugin
$ cd mailgun_plugin
$ pip install -U -r requirements_test.txt

Run tests:

$ pytest

Run coverage:

$ pytest --cov=mailgun_plugin

To show uncovered lines:

$ coverage report --include=mailgun_plugin/* --show-missing

Development

Switch to the root of your Airflow project.

To install:

$ git clone https://github.com/airflow-plugins/mailgun_plugin plugins/mailgun_plugin
$ pip install -U -r plugins/mailgun_plugin/requirements_dev.txt

mailgun_plugin's People

Contributors

benjamingregory avatar tedmiston avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.