8000 Add get_all_subscribers_list_id() + allow options to be passed to get… · kogan/FuelSDK-Python-Wrapper@416a50c · GitHub
[go: up one dir, main page]

Skip to content

Commit 416a50c

Browse files
author
Sebastien.Dangelo
committed
Add get_all_subscribers_list_id() + allow options to be passed to get_objects
1 parent 5cda619 commit 416a50c

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

FuelSDKWrapper.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,14 +559,16 @@ def extract_data(self, parameters):
559559
return res
560560

561561
@validate_response()
562-
def get_objects(self, object_type, search_filter=None, property_list=None, query_all_accounts=False, is_rest=False):
562+
def get_objects(self, object_type, search_filter=None, property_list=None, query_all_accounts=False, is_rest=False, options=None):
563563
obj = self.get_object_class(object_type, is_rest)
564564
if search_filter:
565565
obj.search_filter = search_filter
566566
if property_list:
567567
obj.props = property_list
568568
if query_all_accounts:
569569
obj.QueryAllAccounts = True
570+
if options:
571+
obj.options = options
570572
return obj.get()
571573

572574
@validate_response()
@@ -1136,3 +1138,11 @@ def get_email_preview(self, email_id, list_id=None, data_extension_key=None, con
11361138
token = self.get_client().authToken
11371139
res = requests.post(url, headers={"Authorization": "Bearer {}".format(token)})
11381140
return res.json()
1141+
1142+
def get_all_subscribers_list_id(self):
1143+
res = self.get_objects(ObjectType.LIST_SEND,
1144+
search_filter=simple_filter("List.ListName", Operator.EQUALS, "All Subscribers"),
1145+
property_list=["List.ID"],
1146+
options={"BatchSize": 1})
1147+
if res.results:
1148+
return res.results[0].List.ID

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,10 @@ res = api.get_email_preview(
198198
data_extension_key="My_DE_Key",
199199
contact_key="My_Contact_Key"
200200
)
201+
202+
# Retrieve All Subscribers List ID
203+
# The real ID is not what is sent by the SOAP List object
204+
all_subscribers_list_id = api.get_all_subscribers_list_id()
201205
```
202206

203207
### Get More Results

__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
__title__ = 'FuelSDKWrapper'
2-
__version__ = '1.3.3'
2+
__version__ = '1.3.4'
33
__author__ = 'Seb Angel'
44
__license__ = 'MIT'

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
readme = f.read()
55

66
setup(
7-
version='1.3.3',
7+
version='1.3.4',
88
name='FuelSDKWrapper',
99
description='Simplify and enhance the FuelSDK for Salesforce Marketing Cloud (ExactTarget)',
1010
long_description=readme,

0 commit comments

Comments
 (0)
0