Skip to content
This repository was archived by the owner on Jun 11, 2024. It is now read-only.

Commit 071a4e7

Browse files
committed
add offset parameter to report.get
1 parent 77fe6e4 commit 071a4e7

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
- fix: setup.py not working under some environments (`open` used wrong codec)
55
- add SellerProfile model
6+
- add `offset` parameter to report.get
67

78

89
1.0

atomx/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def report_status(self, report):
216216
raise APIError(r.json()['error'])
217217
return r.json()['report']
218218

219-
def report_get(self, report, limit=None, sort=None):
219+
def report_get(self, report, sort=None, limit=None, offset=None):
220220
"""Get the content (csv) of a :class:`.models.Report`
221221
222222
Typically used by calling :meth:`.models.Report.content` or
@@ -235,6 +235,8 @@ def report_get(self, report, limit=None, sort=None):
235235
params = {}
236236
if limit:
237237
params['limit'] = int(limit)
238+
if offset:
239+
params['offset'] = int(offset)
238240
if sort:
239241
params['sort'] = sort
240242

atomx/models.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,18 +207,19 @@ def status(self):
207207
self.__init__(session=self.session, **status)
208208
return self
209209

210-
def get(self, limit=None, sort=None):
210+
def get(self, sort=None, limit=None, offset=None):
211211
"""Get the first ``limit`` lines of the report ``content``
212212
and in the specified ``sort`` order.
213213
214-
:param int limit: limit the amount of lines to return (defaults to no limit)
215214
:param str sort: defines the sort order of the report content.
216215
``sort`` can be `column_name`[.asc|.desc][,column_name[.asc|.desc]]`...
216+
:param int limit: limit the amount of lines to return (defaults to no limit)
217+
:param int offset: Skip the first `offset` number of lines (defaults to none)
217218
:return: report content
218219
"""
219220
if not self.is_ready:
220221
raise ReportNotReadyError()
221-
return self.session.report_get(self, limit=limit, sort=sort)
222+
return self.session.report_get(self, sort=sort, limit=limit, offset=offset)
222223

223224
@property
224225
def content(self):

0 commit comments

Comments
 (0)