API Reference

This page provides detailed API documentation for the Email Deliverability Library.

DeliverabilityManager

Authentication

SPF

DKIM

DMARC

Reputation

List Hygiene

IP Warming

Resource Management

class email_deliverability.resource_manager.ResourceManager(*args, **kwargs)[source]

Bases: object

Manage external resources like blacklists and IP reputation data.

__init__(cache_dir=None)[source]

Initialize the resource manager.

Parameters:

cache_dir (str) – Directory to store cached resources

download_resource(resource_name, url=None, processor=None, force=False)[source]

Download and cache an external resource.

Parameters:
  • resource_name (str) – Name of the resource

  • url (str) – URL to download the resource from

  • processor (callable) – Function to process the downloaded data

  • force (bool) – Force download even if not needed

Returns:

The downloaded resource data

Return type:

object

load_resource(resource_name)[source]

Load a cached resource.

Parameters:

resource_name (str) – Name of the resource

Returns:

The cached resource data or None if not available

Return type:

object

needs_update(resource_name, max_age_hours=24)[source]

Check if a resource needs updating.

Parameters:
  • resource_name (str) – Name of the resource

  • max_age_hours (int) – Maximum age in hours before update needed

Returns:

True if the resource needs updating

Return type:

bool

start_scheduler(update_time='00:00')[source]

Start a background scheduler to update resources daily.

Parameters:

update_time (str) – Time to update resources daily (HH:MM format)

stop_scheduler()[source]

Stop the background resource update scheduler.

update_all_resources()[source]

Update all registered resources.

email_deliverability.resource_manager.update_deliverability_resources()[source]

Update all email deliverability resources. This function can be called directly or scheduled to run periodically.

Returns:

Status of each resource update

Return type:

dict

email_deliverability.resource_manager.start_resource_updater(update_time='03:00')[source]

Start the background resource updater to refresh data daily.

Parameters:

update_time (str) – Time to update resources daily (HH:MM format)

Returns:

True if scheduler started successfully

Return type:

bool