Created
July 12, 2011 16:19
-
-
Save brendanc/1078332 to your computer and use it in GitHub Desktop.
Create a Litmus Email Test using the Litmus Resller API and Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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