Skip to content

Commit

Permalink
added endpoint to get the list segment subscribers
Browse files Browse the repository at this point in the history
  • Loading branch information
ghimes committed Apr 18, 2024
1 parent c4c8659 commit d935003
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 1 deletion.
20 changes: 20 additions & 0 deletions examples/list_segments.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,23 @@
DISPLAY RESPONSE
"""
print(response.content)

"""
GET ONE ITEM
"""
response = endpoint.get_segment(list_uid='LIST_UID', segment_uid='SEGMENT_UID')

"""
DISPLAY RESPONSE
"""
print(response.content)

"""
GET ALL SUBSCRIBERS OF A LIST SEGMENT
"""
response = endpoint.get_subscribers(list_uid='LIST_UID', segment_uid='SEGMENT_UID', page=1, per_page=10)

"""
DISPLAY RESPONSE
"""
print(response.content)
48 changes: 48 additions & 0 deletions mailwizz/endpoint/list_segments.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,51 @@ def get_segments(self, list_uid: str, page=1, per_page=10):
})

return client.request()

def get_segment(self, list_uid: str, segment_uid: str):
"""
Get segments from a certain mail list
:param list_uid:
:param segment_uid:
:return:
"""

client = Client({
'method': Client.METHOD_GET,
'url': self.config.get_api_url(
'lists/{list_uid}/segments/{segment_uid}'.format(
list_uid=list_uid,
segment_uid=segment_uid
)
),
'params_get': {}
})

return client.request()

def get_subscribers(self, list_uid: str, segment_uid: str, page=1, per_page=10):
"""
Get subscribers from a certain mail list segment
:param list_uid:
:param segment_uid:
:param page:
:param per_page:
:return:
"""

client = Client({
'method': Client.METHOD_GET,
'url': self.config.get_api_url(
'lists/{list_uid}/segments/{segment_uid}/subscribers'.format(
list_uid=list_uid,
segment_uid=segment_uid
)
),
'params_get': {
'page': page,
'per_page': per_page
}
})

return client.request()

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name='mailwizz-python-sdk',
version='1.0.2',
version='1.0.3',
packages=setuptools.find_packages(),
url='https://www.mailwizz.com',
license='MIT',
Expand Down

0 comments on commit d935003

Please sign in to comment.