Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/xsleonard/flask-pystmark

Flask extension for Pystmark
https://github.com/xsleonard/flask-pystmark

email flask-extension postmark postmarkapp python

Last synced: 1 day ago
JSON representation

Flask extension for Pystmark

Awesome Lists containing this project

README

        

Flask-Pystmark
==============

[![PyPI version](https://badge.fury.io/py/Flask-Pystmark.png)](http://badge.fury.io/py/Flask-Pystmark)
[![Build Status](https://travis-ci.org/xsleonard/flask-pystmark.png)](https://travis-ci.org/xsleonard/flask-pystmark)
[![Coverage Status](https://coveralls.io/repos/xsleonard/flask-pystmark/badge.png)](https://coveralls.io/r/xsleonard/flask-pystmark)

Flask extension for [Pystmark](https://github.com/xsleonard/pystmark), a Postmark API library.

Flask-Pystmark supports Python 2.7, 3.6 and PyPy.

[Read the complete docs](https://flask-pystmark.readthedocs.org)

To run the tests, do `python setup.py test`

Example:

```python
# app.py
from flask import Flask
from flask_pystmark import Pystmark, Message
from pystmark import ResponseError

app = Flask(__name__)
app.config['PYSTMARK_API_KEY'] = 'your_api_key'
app.config['PYSTMARK_DEFAULT_SENDER'] = '[email protected]'
pystmark = Pystmark(app)

@app.route('/')
def send():
m = Message(to='[email protected]', text='Welcome')
resp = pystmark.send(m)
try:
resp.raise_for_status()
except ResponseError as e:
return 'Failed to send message. Reason: {}'.format(e)
else:
return 'Sent message to {}'.format(resp.message.to)
```