Skip to content

Commit d935003

Browse files
committed
added endpoint to get the list segment subscribers
1 parent c4c8659 commit d935003

3 files changed

Lines changed: 69 additions & 1 deletion

File tree

examples/list_segments.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,23 @@
2121
DISPLAY RESPONSE
2222
"""
2323
print(response.content)
24+
25+
"""
26+
GET ONE ITEM
27+
"""
28+
response = endpoint.get_segment(list_uid='LIST_UID', segment_uid='SEGMENT_UID')
29+
30+
"""
31+
DISPLAY RESPONSE
32+
"""
33+
print(response.content)
34+
35+
"""
36+
GET ALL SUBSCRIBERS OF A LIST SEGMENT
37+
"""
38+
response = endpoint.get_subscribers(list_uid='LIST_UID', segment_uid='SEGMENT_UID', page=1, per_page=10)
39+
40+
"""
41+
DISPLAY RESPONSE
42+
"""
43+
print(response.content)

mailwizz/endpoint/list_segments.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,51 @@ def get_segments(self, list_uid: str, page=1, per_page=10):
2626
})
2727

2828
return client.request()
29+
30+
def get_segment(self, list_uid: str, segment_uid: str):
31+
"""
32+
Get segments from a certain mail list
33+
:param list_uid:
34+
:param segment_uid:
35+
:return:
36+
"""
37+
38+
client = Client({
39+
'method': Client.METHOD_GET,
40+
'url': self.config.get_api_url(
41+
'lists/{list_uid}/segments/{segment_uid}'.format(
42+
list_uid=list_uid,
43+
segment_uid=segment_uid
44+
)
45+
),
46+
'params_get': {}
47+
})
48+
49+
return client.request()
50+
51+
def get_subscribers(self, list_uid: str, segment_uid: str, page=1, per_page=10):
52+
"""
53+
Get subscribers from a certain mail list segment
54+
:param list_uid:
55+
:param segment_uid:
56+
:param page:
57+
:param per_page:
58+
:return:
59+
"""
60+
61+
client = Client({
62+
'method': Client.METHOD_GET,
63+
'url': self.config.get_api_url(
64+
'lists/{list_uid}/segments/{segment_uid}/subscribers'.format(
65+
list_uid=list_uid,
66+
segment_uid=segment_uid
67+
)
68+
),
69+
'params_get': {
70+
'page': page,
71+
'per_page': per_page
72+
}
73+
})
74+
75+
return client.request()
76+

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name='mailwizz-python-sdk',
8-
version='1.0.2',
8+
version='1.0.3',
99
packages=setuptools.find_packages(),
1010
url='https://www.mailwizz.com',
1111
license='MIT',

0 commit comments

Comments
 (0)