Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

Commit

Permalink
add offset and limit
Browse files Browse the repository at this point in the history
  • Loading branch information
skoudoro committed Jan 13, 2022
1 parent 5873f8d commit 0a2f191
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions mailerlite/subscriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,8 @@ def groups(self, as_json=False, **identifier):
all_groups = [Group(**res) for res in res_json]
return all_groups

def activity(self, as_json=False, atype=None, **identifier):
def activity(self, as_json=False, atype=None, limit=100,
offset=0, **identifier):
"""Get activities (clicks, opens, etc) of selected subscriber.
More informations:
Expand All @@ -379,13 +380,18 @@ def activity(self, as_json=False, atype=None, **identifier):
* unsubscribes
* forwards
* sendings
limit : int, optional
How many subscribers you want, default 100
offset : int, optional
page index, default 0
Returns
-------
activities: list
all subscriber activities. More informations :
https://developers.mailerlite.com/v2/reference#activity-of-single-subscriber
"""
params = {'limit': limit, 'offset': offset}
path = get_id_or_email_identifier(**identifier)
if path is None:
raise IOError('An identifier must be define')
Expand All @@ -399,7 +405,7 @@ def activity(self, as_json=False, atype=None, **identifier):
' be {0}'.format(possible_atype))
args.append(atype)

url = client.build_url(*args)
url = client.build_url(*args, **params)

_, res_json = client.get(url, headers=self.headers)

Expand Down

0 comments on commit 0a2f191

Please sign in to comment.