Giter VIP home page Giter VIP logo

pystmark's Introduction

pystmark

Postmark API library for python 2.6, 2.7, 3.x and pypy. Built on top of the requests library.

Build Status

Documentation

The full Sphinx-compiled documentation is available here: https://readthedocs.org/docs/pystmark/en/latest/

Example Usage

import pystmark

API_KEY = 'my_api_key'
SENDER = '[email protected]'

# Send a single message
message = pystmark.Message(sender=SENDER, to='[email protected]', subject='Hi',
                           text='A message', tag='greeting')
pystmark.send(message, api_key=API_KEY)


# Send multiple messages (via Postmark's batch send API)
recipients = ['you{0}@example.com'.format(i) for i in xrange(20)]
messages = [pystmark.Message(sender=SENDER, to=to, subject='Hi',
                             text='A message', tag='greeting')
            for to in recipients]

response = pystmark.send_batch(messages, api_key=API_KEY)

# Check API response error
try:
    response.raise_for_status()
except pystmark.UnauthorizedError:
    print 'Use your real API key'

Contribution

  1. Fork this repo
  2. Make your changes and write a test for them
  3. Add yourself to the AUTHORS file and submit a pull request

Please run the tests with ./setup.py test --with-integration, with at least python2.7, before you make a pull request. Requirements for running the tests are in tests/requirements.txt. The other versions will be handled by travis-ci.

The pep8 tests may fail if using pypy due to this bug, so that test is disabled if pypy is detected.

Web Framework Integration

If you would like to integrate this with some web framework, write a separate module and I'll link to it from here.

Copyright and License

pystmark is licensed under the MIT license. See the LICENSE file for full details.

pystmark's People

Watchers

Simon Hewitt avatar James Cloos 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.