Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xsleonard/flask-pystmark
Flask extension for Pystmark
https://github.com/xsleonard/flask-pystmark
email flask-extension postmark postmarkapp python
Last synced: 3 months ago
JSON representation
Flask extension for Pystmark
- Host: GitHub
- URL: https://github.com/xsleonard/flask-pystmark
- Owner: xsleonard
- License: mit
- Created: 2013-10-09T22:18:52.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2019-09-26T10:03:29.000Z (over 5 years ago)
- Last Synced: 2024-10-03T10:44:59.747Z (4 months ago)
- Topics: email, flask-extension, postmark, postmarkapp, python
- Language: Python
- Size: 43 KB
- Stars: 8
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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 ResponseErrorapp = 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)
```