sparkpost.suppression_list

class sparkpost.suppression_list.SuppressionList(base_uri, api_key, transport_class=<class 'sparkpost.base.RequestsTransport'>)

SuppressionList class used to search, get and modify suppression status. For detailed request and response formats, see the Suppresion List API documentation.

create(entry)

Create a suppression list entry.

Parameters:status (dict|list) – If dict it is a single entry to create { 'email': 'test@test.com', 'transactional': True, 'non_transactional': True, 'description': 'Test description' }, if list it is multiple entries to create
Returns:a dict with a message
Raises:SparkPostAPIException if API call fails
delete(email)

Delete the suppression status for a specific recipient by email

Parameters:email (str) – Email of the recipient whose status you want to remove
Returns:TODO
Raises:SparkPostAPIException if API call fails
get(email)

Retrieve a suppression list entry for a specific recipient by email

Parameters:email (str) – Email of the recipient whose status you want to check_status
Returns:a suppression list entry
Raises:SparkPostAPIException if API call fails
list(**kwargs)

List supression list entries based on the supplied parameters

Parameters:
  • from_date (datetime) – DateTime to start listing
  • to_date (datetime) – DateTime to end listing
  • types (list) – Types of entries to return
  • limit (int) – Maximum number of entries to return
Returns:

a list of entries

Raises:

SparkPostAPIException if API call fails

update(entry)

Update a suppression list entry.

Parameters:status (dict|list) – If dict it is a single entry to update { 'email': 'test@test.com', 'transactional': True, 'non_transactional': True, 'description': 'Test description' }, if list it is multiple entries to update
Returns:a dict with a message
Raises:SparkPostAPIException if API call fails