/txmandrill-api

The Mandrill Python client but for Twisted.

Primary LanguagePythonOtherNOASSERTION

txmandrill-api

Build Status Coverage Status Downloads Latest Version

The Mandrill Python client but for Twisted.


*[Mandrill - Oregon Zoo (Kathy & Sam)](https://www.flickr.com/photos/39871249@N07/5495737139/in/photostream/)*

Installation

> pip install txmandrill

Usage

Exactly the same as the mandrill-api-python library, 'cept every method returns a Deferred. Simple as.

Example

from pprint import pprint

from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks

from txmandrill import TXMandrill


@inlineCallbacks
def ping_and_get_users():
    mandrill_client = TXMandrill('YOUR_API_KEY')

    # Ping
    result = yield mandrill_client.users.ping()
    pprint(result)

    # Return the information about the API-connected user
    result = yield mandrill_client.users.info()
    pprint(result)


if __name__ == "__main__":
    df = ping_and_get_users()
    df.addErrback(lambda err: err.printTraceback())
    df.addCallback(lambda _: reactor.stop())
    reactor.run()

License

Apache (as per original project).