def test_get_ip_rollup_details(): it = InboxTracker("fake-key") endpoint = "/rollup/details" url = it.spam_trap.ip.uri + endpoint responses.add(responses.GET, url, status=200, content_type='application/json', body='{"results": "yay"}') json_output = it.spam_trap.ip.get_ip_rollup_details() assert json_output == 'yay'
def test_get_domain_perf(): it = InboxTracker("fake-key") endpoint = "/domain" url = it.postmaster_tools.yahoo.uri + endpoint responses.add(responses.GET, url, status=200, content_type='application/json', body='{"results": "yay"}') json_output = it.postmaster_tools.yahoo.get_domain_perf() assert json_output == 'yay'
def test_ping_service(): it = InboxTracker("fake-key") endpoint = "" url = it.ping.uri + endpoint responses.add(responses.GET, url, status=200, content_type='application/json', body='{"results": "yay"}') output = it.ping.ping_service() assert output == "yay"
def test_get_available_domains(): it = InboxTracker("fake-key") endpoint = "" url = it.spam_trap.available_domains.uri + endpoint responses.add(responses.GET, url, status=200, content_type='application/json', body='{"results": "yay"}') json_output = it.spam_trap.available_domains.get_available_domains() assert json_output == 'yay'
def test_get_last_update(): it = InboxTracker("fake-key") endpoint = "/lastUpdate" url = it.seeds.uri + endpoint responses.add(responses.GET, url, status=200, content_type='application/json', body='{"results": "yay"}') json_output = it.seeds.get_last_update() assert json_output == 'yay'
def test_get_campaigns(): it = InboxTracker("fake-key") qd = "test-qd" endpoint = "" url = it.campaigns.uri + endpoint responses.add(responses.GET, url, status=200, content_type='application/json', body='{"results": "yay"}') json_output = it.campaigns.get_campaigns(qd=qd) assert json_output == 'yay'
def test_get_campaign_by_id(): it = InboxTracker("fake-key") campaignId = "test-campaign" embed = "test-embed" endpoint = "/" + str(campaignId) url = it.campaigns.uri + endpoint responses.add(responses.GET, url, status=200, content_type='application/json', body='{"results": "yay"}') json_output = it.campaigns.get_campaign_by_id(campaignId, embed=embed) assert json_output == 'yay'
def test_get_deliverability_by_domain(): it = InboxTracker("fake-key") domain = "test-domain" qd = "test-qd" endpoint = "/" + str(domain) url = it.deliverability.uri + endpoint responses.add(responses.GET, url, status=200, content_type='application/json', body='{"results": "yay"}') json_output = it.deliverability.get_deliverability_by_domain(domain, qd=qd) assert json_output == 'yay'
def test_delete_intelliseed_filter(): it = InboxTracker("fake-key") filterSetId = "test-filterSetId" endpoint = "/filter_sets/" + str(filterSetId) url = it.intelliseeds.uri + endpoint responses.add( responses.DELETE, url, status=200, content_type='application/json', body='{"results": "yay"}' ) json_output = it.intelliseeds.delete_intelliseed_filter(filterSetId) assert json_output == 'yay'
def test_create_intelliseed_filter(): it = InboxTracker("fake-key") endpoint = "/filter_sets" url = it.intelliseeds.uri + endpoint responses.add( responses.POST, url, status=200, content_type='application/json', body='{"results": "yay"}' ) json_output = it.intelliseeds.create_intelliseed_filter( name="name", listType="PUBLIC", simulatedEngagementOption="ALL", percentOfList="test-pct", regions=["test-region"] ) assert json_output == 'yay'
from inboxtracker import InboxTracker from datetime import datetime, timedelta # Set number of days to check - if the IntelliSeed was updated within this window, we will update update_window_days = 1 # Get date of most recent update to IntelliSeed list it = InboxTracker("YOUR_API_KEY") # Instantiate InboxTracker response = it.intelliseeds.get_last_update() last_updated = response[0]["lastUpdated"] last_updated_dt = datetime.strptime(last_updated, '%Y-%m-%dT%H:%M:%S.%fZ') # Determine cutoff date to check update_threshold_dt = datetime.today() - timedelta(days=update_window_days) # Check if the IntelliSeed list needs to be updated if last_updated_dt >= update_threshold_dt: # Retrieve updated IntelliSeed list updated_intelliseed_list = it.intelliseeds.get_intelliseeds() print(updated_intelliseed_list) else: print("No need to update our list")