Permalink
Fetching contributors…
Cannot retrieve contributors at this time
97 lines (55 sloc) 2.07 KB

SparkPost Python API client

The super-mega-official Python package for using the SparkPost API.

Installation

Install from PyPI using pip:

$ pip install sparkpost

Authorization

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')

For SparkPost EU and Enterprise accounts, pass in a second parameter to set the API host.

from sparkpost import SparkPost
sp = SparkPost('YOUR API KEY', 'https://api.eu.sparkpost.com/api')

Resources

The following resources are available in python-sparkpost:

.. toctree::
    :glob:
    :maxdepth: 1

    resources/*


API reference

Auto-generated API reference for python-sparkpost:

.. toctree::
    :maxdepth: 2

    api

Using in Django

Configure Django to use SparkPost email backend

.. toctree::
    :maxdepth: 2

    django/backend


Additional documentation

The underlying SparkPost API is documented at the official SparkPost API Reference.

Contribute

  1. Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug.
  2. Fork the repository on GitHub and make your changes in a branch on your fork
  3. Write a test which shows that the bug was fixed or that the feature works as expected.
  4. Send a pull request. Make sure to add yourself to AUTHORS.