Fluent API for MailGun HTTP API
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
mailgunv3
.gitignore
.travis.yml
API.rst
CHANGES.rst
LICENSE
MANIFEST.in
Makefile
README.rst
conf.py
make.bat
requirements.txt
setup.py

README.rst

MailGun V3

This package provides fluent API for MailGun API.

build status Documentation Status Code Climate Issue Count

.. toctree::
   :maxdepth: 2

   CHANGES
   API

Installation

pip install mailgunv3

Usage

domain = 'example.com'

mg = MailGunV3(domain,
               'key-asdfghjkl',
               'pubkey-asdfghjkl')

res1 = (mg.
        mailinglist('mlA-{}@{}'.format(random.randint(0, 10), domain)).
        create('Test Mailing List').
        delete())
print(repr(res1))

res2 = (mg.
        mailinglist('mlB-{}@{}'.format(random.randint(0, 10), domain)).
        create('Test Mailing List').
        update(
            name='New Name',
            description='New Description').
        get())
print(repr(res2))

res3 = (mg.
        mailinglist('newsletter-dev@' + domain).
        members())
print(repr(res3))

res4 = (mg.
        mailinglist('newsletter-dev@' + domain).
        member('a01-{}@{}'.format(random.randint(0, 1000), domain)).
        create(
            name='Foo Bar',
            params={'a': 1, 'b': 2}).
        get())
print(repr(res4))

res5 = (mg.
        mailinglist('newsletter-dev@' + domain).
        member('a01-{}@{}'.format(random.randint(0, 1000), domain)).
        update(
            name='Foo Bar - EDIT',
            params={'a': 1, 'b': 2}).
        get())
print(repr(res5))

res6 = (mg.
        mailinglist('newsletter-dev@' + domain).
        members())
print(repr(res6))

res7 = (mg.
        mailinglist('newsletter-dev@' + domain).
        member('a01@' + domain).
        delete())
print(repr(res7))

External Links