SparkPost Python API client
Project description
The super-mega-official Python package for using the SparkPost API.
Installation
Install from PyPI using pip:
$ pip install sparkpost
To install a pre-release version (dev, alpha, beta, rc):
$ pip install --pre sparkpost
Get a key
Go to API & SMTP in the SparkPost app and create an API key. We recommend using the SPARKPOST_API_KEY environment variable:
from sparkpost import SparkPost
sp = SparkPost() # uses environment variable
Alternatively, you can pass the API key to the SparkPost class:
from sparkpost import SparkPost
sp = SparkPost('YOUR API KEY')
Send a message
Here at SparkPost, our messages are known as transmissions. Let’s use the underlying transmissions API to send a friendly test message:
from sparkpost import SparkPost
sp = SparkPost()
response = sp.transmissions.send(
recipients=['someone@somedomain.com'],
html='<p>Hello world</p>',
from_email='test@sparkpostbox.com',
subject='Hello from python-sparkpost'
)
print response
# outputs {u'total_accepted_recipients': 1, u'id': u'47960765679942446', u'total_rejected_recipients': 0}
Documentation
Documentation for python-sparkpost
Contribute
Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug.
Fork the repository on GitHub and make your changes in a branch on your fork
Write a test which shows that the bug was fixed or that the feature works as expected.
Send a pull request. Make sure to add yourself to AUTHORS.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for sparkpost-1.0.0.dev2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00de88ba7552b4402557b362deacab30e4d2a3260c96fa82ed6be4ea336de42c |
|
MD5 | d2e2462569ce6887116d6e90948a0eda |
|
BLAKE2b-256 | 3f4a3e196c729f89af4c791f4681f997ad953902b6432ef0d596aedfad88681f |