@@ -119,11 +119,16 @@ def __init__(self, auth_stub, obj_type):
119119##
120120########
121121class ET_Configure (ET_Constructor ):
122- def __init__ (self , auth_stub , obj_type , props = None , update = False ):
122+ def __init__ (self , auth_stub , obj_type , props = None , update = False , delete = False ):
123123 auth_stub .refresh_token ()
124124
125125 ws_configureRequest = auth_stub .soap_client .factory .create ('ConfigureRequestMsg' )
126- ws_configureRequest .Action = 'create' if update is False else 'update'
126+ action = 'create'
127+ if delete :
128+ action = 'delete'
129+ elif update :
130+ action = 'update'
131+ ws_configureRequest .Action = action
127132 ws_configureRequest .Configurations = {'Configuration' : self .parse_props_into_ws_object (auth_stub , obj_type , props )}
128133
129134 response = auth_stub .soap_client .service .Configure (None , ws_configureRequest )
@@ -138,7 +143,7 @@ def __init__(self, auth_stub, obj_type, props = None, update = False):
138143##
139144########
140145class ET_Get (ET_Constructor ):
141- def __init__ (self , auth_stub , obj_type , props = None , search_filter = None ):
146+ def __init__ (self , auth_stub , obj_type , props = None , search_filter = None , options = None ):
142147 auth_stub .refresh_token ()
143148
144149 if props is None : #if there are no properties to retrieve for the obj_type then return a Description of obj_type
@@ -187,6 +192,14 @@ def __init__(self, auth_stub, obj_type, props = None, search_filter = None):
187192 ws_simpleFilterPart [prop [0 ]] = search_filter [prop [0 ]]
188193 ws_retrieveRequest .Filter = ws_simpleFilterPart
189194
195+ if options is not None :
196+ for key , value in options .iteritems ():
197+ if isinstance (value , dict ):
198+ for k , v in value .iteritems ():
199+ ws_retrieveRequest .Options [key ][k ] = v
200+ else :
201+ ws_retrieveRequest .Options [key ] = value
202+
190203 ws_retrieveRequest .ObjectType = obj_type
191204
192205 response = auth_stub .soap_client .service .Retrieve (ws_retrieveRequest )
@@ -264,6 +277,7 @@ class ET_BaseObject(object):
264277 props = None
265278 extProps = None
266279 search_filter = None
280+ options = None
267281
268282########
269283##
@@ -273,9 +287,10 @@ class ET_BaseObject(object):
273287class ET_GetSupport (ET_BaseObject ):
274288 obj_type = 'ET_GetSupport' #should be overwritten by inherited class
275289
276- def get (self , m_props = None , m_filter = None ):
290+ def get (self , m_props = None , m_filter = None , m_options = None ):
277291 props = self .props
278292 search_filter = self .search_filter
293+ options = self .options
279294
280295 if m_props is not None and type (m_props ) is list :
281296 props = m_props
@@ -285,7 +300,10 @@ def get(self, m_props = None, m_filter = None):
285300 if m_filter is not None and type (m_filter ) is dict :
286301 search_filter = m_filter
287302
288- obj = ET_Get (self .auth_stub , self .obj_type , props , search_filter )
303+ if m_options is not None and type (m_filter ) is dict :
304+ options = m_options
305+
306+ obj = ET_Get (self .auth_stub , self .obj_type , props , search_filter , options )
289307 if obj is not None :
290308 self .last_request_id = obj .request_id
291309 return obj
0 commit comments