import ET_Client try: debug = False stubObj = ET_Client.ET_Client(False, debug) NewListName = "PythonSDKList" ## Example using AddSubscriberToList() method ## Typically this method will be used with a pre-existing list but for testing purposes one is being created. # Create List print('>>> Create List') postList = ET_Client.ET_List() postList.auth_stub = stubObj postList.props = { "ListName": NewListName, "Description": "This list was created with the PythonSDK", "Type": "Private" } postResponse = postList.post() print('Post Status: ' + str(postResponse.status)) print('Code: ' + str(postResponse.code)) print('Message: ' + str(postResponse.message)) print('Result Count: ' + str(len(postResponse.results))) print('Results: ' + str(postResponse.results)) if postResponse.status: newListID = postResponse.results[0]['NewID'] # Adding Subscriber To a List
def get_list_by_name(self, name): lists = ET_Client.ET_List() lists.auth_stub = self.auth_stub lists.search_filter = {'Property' : 'ListName', 'SimpleOperator' : 'like', 'Value' : name} lists.props = ["ID","PartnerKey","CreatedDate","ModifiedDate","Client.ID","Client.PartnerClientKey","ListName","Description","Category","Type","CustomerKey","ListClassification","AutomatedEmail.ID"] return lists.get()
from __future__ import print_function import ET_Client try: debug = False stubObj = ET_Client.ET_Client(False, debug) NewListName = "PythonSDKList" # Create List print('>>> Create List') postList = ET_Client.ET_List() postList.auth_stub = stubObj postList.props = { "ListName": NewListName, "Description": "This list was created with the PythonSDK", "Type": "Private" } postResponse = postList.post() print('Post Status: ' + str(postResponse.status)) print('Code: ' + str(postResponse.code)) print('Message: ' + str(postResponse.message)) print('Result Count: ' + str(len(postResponse.results))) print('Results: ' + str(postResponse.results)) # Make sure the list created correctly and the 1st dict in it has a NewID... if postResponse.status and 'NewID' in postResponse.results[0]: newListID = postResponse.results[0]['NewID']
def get_lists(self): lists = ET_Client.ET_List() lists.auth_stub = self.auth_stub lists.props = ["ID","ListName","Description","Category","Type"] return lists.get()