Skip to content

Commit

Permalink
Add limit parameter to Package.get_history (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcermak authored Nov 4, 2024
1 parent 361d83a commit c10d5d1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions osctiny/extensions/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,21 +346,25 @@ def get_attribute(self, project, package, attribute=None):

return self.osc.get_objectified_xml(response)

def get_history(self, project, package):
def get_history(self, project, package, limit = None):
"""
Get history of package
:param project: name of project
:param package: name of package
:param limit: Optional number of history entries to return. If
specified, only the last n entries are returned.
:return: Objectified XML element
:rtype: lxml.objectify.ObjectifiedElement
"""
params = {"limit": limit} if limit else {}
response = self.osc.request(
url=urljoin(
self.osc.url,
"{}/{}/{}/_history".format(self.base_path, project, package)
),
method="GET"
method="GET",
params=params,
)

return self.osc.get_objectified_xml(response)
Expand Down

0 comments on commit c10d5d1

Please sign in to comment.