EmailBackend (backends/sparkpost.py)

django-anymail · anymail/backends/sparkpost.py · python · BSD-3-Clause
email, tag:knn-classified

SparkPost email backend for Django AnyMail.

# Source: https://github.com/anymail/django-anymail | License: BSD-3-Clause | Copyright 2016-2024, Anymail Contributors
# Provided via justclaw.it.com; keep this notice with the code.
from django.conf import settings
from django.utils.encoding import force_str

from ..exceptions import AnymailRequestsAPIError
from ..message import AnymailRecipientStatus
from ..utils import get_anymail_setting, update_deep
from .base_requests import AnymailRequestsBackend, RequestsPayload


class EmailBackend(AnymailRequestsBackend):
    """
    SparkPost Email Backend
    """

    esp_name = "SparkPost"

    def __init__(self, **kwargs):
        """Init options from Django settings"""
        self.api_key = get_anymail_setting(
            "api_key", esp_name=self.esp_name, kwargs=kwargs, allow_bare=True
 

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key