Skip to content

Instantly share code, notes, and snippets.

@brendanc
Created July 12, 2011 16:19
Show Gist options
  • Select an option

  • Save brendanc/1078332 to your computer and use it in GitHub Desktop.

Select an option

Save brendanc/1078332 to your computer and use it in GitHub Desktop.
Create a Litmus Email Test using the Litmus Resller API and Python
import suds
from suds import WebFault
from suds.client import Client
from suds.xsd.sxbasic import Import
import logging
logging.basicConfig(level=logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)
# Sample code to create a new email test using Litmus' Reseller Api
# This sample uses SUDS, available at : https://fedorahosted.org/suds/
url = 'https://soapapi.litmusapp.com/2010-06-21/api.asmx?wsdl'
api_key = "api-key"
api_pass = "api-password"
client = Client(url)
##clients = client.service.GetEmailTestClients(api_key,api_pass)
##print clients
email_test = client.factory.create('ns1:EmailTest')
email_test.Sandbox = "true"
email_test.Results = client.factory.create('ns1:ArrayOfClient')
email_client1 = client.factory.create('ns1:Client')
#very important - you must set the id on the clients
email_client1.ApplicationName = 'ol2003'
email_client1.Id = 0
email_client2 = client.factory.create('ns1:Client')
email_client2.ApplicationName = 'ol2007'
email_client2.Id = 0
email_test.Results = [email_client1, email_client2]
result = client.service.CreateEmailTest(api_key, api_pass, email_test)
print result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment