From c10d5d11d1b56de258337a9b2807b569eb7eaf31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= Date: Mon, 4 Nov 2024 10:37:46 +0100 Subject: [PATCH] Add limit parameter to Package.get_history (#196) --- osctiny/extensions/packages.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/osctiny/extensions/packages.py b/osctiny/extensions/packages.py index 17a5827..11f98f0 100644 --- a/osctiny/extensions/packages.py +++ b/osctiny/extensions/packages.py @@ -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)