From b014e3de23f0024a91a07c20cfd44ff88ea78424 Mon Sep 17 00:00:00 2001 From: Mischa Spiegelmock Date: Tue, 8 May 2018 01:43:28 -0700 Subject: [PATCH] add offset to get_emails/get_email_templates --- marketorestpython/client.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/marketorestpython/client.py b/marketorestpython/client.py index c87ec01..de7c0f8 100644 --- a/marketorestpython/client.py +++ b/marketorestpython/client.py @@ -1661,7 +1661,7 @@ def delete_email_template(self, id): raise MarketoException(result['errors'][0]) return result['result'] - def get_email_templates(self, maxReturn=None, status=None): + def get_email_templates(self, maxReturn=None, offset=None, status=None): self.authenticate() args = { 'access_token': self.token @@ -1670,10 +1670,13 @@ def get_email_templates(self, maxReturn=None, status=None): args['maxReturn'] = maxReturn else: maxReturn = 20 + if offset is not None: + args['offset'] = offset + else: + offset = 0 if status is not None: args['status'] = status result_list = [] - offset = 0 while True: self.authenticate() # for long-running processes, this updates the access token @@ -1917,7 +1920,7 @@ def update_email(self, id, name=None, description=None): raise MarketoException(result['errors'][0]) return result['result'] - def get_emails(self, maxReturn=None, status=None, folderId=None, folderType=None): + def get_emails(self, maxReturn=None, offset=None, status=None, folderId=None, folderType=None): self.authenticate() args = { 'access_token': self.token @@ -1926,13 +1929,16 @@ def get_emails(self, maxReturn=None, status=None, folderId=None, folderType=None args['maxReturn'] = maxReturn else: maxReturn = 20 + if offset is not None: + args['offset'] = offset + else: + offset = 0 if status is not None: args['status'] = status if folderId is not None: args['folder'] = "{'id': " + \ str(folderId) + ", 'type': " + folderType + "}" result_list = [] - offset = 0 while True: self.authenticate() # for long-running processes, this updates the access token