Skip to content

Commit c10d5d1

Browse files
authored
Add limit parameter to Package.get_history (#196)
1 parent 361d83a commit c10d5d1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

osctiny/extensions/packages.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -346,21 +346,25 @@ def get_attribute(self, project, package, attribute=None):
346346

347347
return self.osc.get_objectified_xml(response)
348348

349-
def get_history(self, project, package):
349+
def get_history(self, project, package, limit = None):
350350
"""
351351
Get history of package
352352
353353
:param project: name of project
354354
:param package: name of package
355+
:param limit: Optional number of history entries to return. If
356+
specified, only the last n entries are returned.
355357
:return: Objectified XML element
356358
:rtype: lxml.objectify.ObjectifiedElement
357359
"""
360+
params = {"limit": limit} if limit else {}
358361
response = self.osc.request(
359362
url=urljoin(
360363
self.osc.url,
361364
"{}/{}/{}/_history".format(self.base_path, project, package)
362365
),
363-
method="GET"
366+
method="GET",
367+
params=params,
364368
)
365369

366370
return self.osc.get_objectified_xml(response)

0 commit comments

Comments
 (0)