Skip to content

Commit c1a95a8

Browse files
author
Randy
committed
Added Support for setting RetrieveOptions in Retrieve requests. See https://help.exacttarget.com/en/technical_library/web_service_guide/objects/retrieveoptions/
1 parent 96c58e8 commit c1a95a8

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

FuelSDK/rest.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def __init__(self, auth_stub, obj_type, props = None, update = False, delete = F
143143
##
144144
########
145145
class ET_Get(ET_Constructor):
146-
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):
147147
auth_stub.refresh_token()
148148

149149
if props is None: #if there are no properties to retrieve for the obj_type then return a Description of obj_type
@@ -192,6 +192,14 @@ def __init__(self, auth_stub, obj_type, props = None, search_filter = None):
192192
ws_simpleFilterPart[prop[0]] = search_filter[prop[0]]
193193
ws_retrieveRequest.Filter = ws_simpleFilterPart
194194

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+
195203
ws_retrieveRequest.ObjectType = obj_type
196204

197205
response = auth_stub.soap_client.service.Retrieve(ws_retrieveRequest)
@@ -269,6 +277,7 @@ class ET_BaseObject(object):
269277
props = None
270278
extProps = None
271279
search_filter = None
280+
options = None
272281

273282
########
274283
##
@@ -278,9 +287,10 @@ class ET_BaseObject(object):
278287
class ET_GetSupport(ET_BaseObject):
279288
obj_type = 'ET_GetSupport' #should be overwritten by inherited class
280289

281-
def get(self, m_props = None, m_filter = None):
290+
def get(self, m_props = None, m_filter = None, m_options = None):
282291
props = self.props
283292
search_filter = self.search_filter
293+
options = self.options
284294

285295
if m_props is not None and type(m_props) is list:
286296
props = m_props
@@ -290,7 +300,10 @@ def get(self, m_props = None, m_filter = None):
290300
if m_filter is not None and type(m_filter) is dict:
291301
search_filter = m_filter
292302

293-
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)
294307
if obj is not None:
295308
self.last_request_id = obj.request_id
296309
return obj

0 commit comments

Comments
 (0)