diff --git a/tools/autoupdate_app_sources/rest_api.py b/tools/autoupdate_app_sources/rest_api.py index d097bf35ea..99aafad71c 100644 --- a/tools/autoupdate_app_sources/rest_api.py +++ b/tools/autoupdate_app_sources/rest_api.py @@ -6,12 +6,12 @@ import requests +ITEMS_LIMIT=100 class RefType(Enum): tags = 1 commits = 2 - class GithubAPI: def __init__(self, upstream: str, auth: Optional[tuple[str, str]] = None): self.upstream = upstream @@ -29,7 +29,7 @@ def internal_api(self, uri: str) -> Any: def tags(self) -> list[dict[str, str]]: """Get a list of tags for project.""" - return self.internal_api(f"repos/{self.upstream_repo}/tags") + return self.internal_api(f"repos/{self.upstream_repo}/tags?per_page={ITEMS_LIMIT}" def commits(self) -> list[dict[str, Any]]: """Get a list of commits for project.""" @@ -37,7 +37,7 @@ def commits(self) -> list[dict[str, Any]]: def releases(self) -> list[dict[str, Any]]: """Get a list of releases for project.""" - return self.internal_api(f"repos/{self.upstream_repo}/releases?per_page=100") + return self.internal_api(f"repos/{self.upstream_repo}/releases?per_page={ITEMS_LIMIT}" def url_for_ref(self, ref: str, ref_type: RefType) -> str: """Get a URL for a ref.""" @@ -92,7 +92,7 @@ def internal_api(self, uri: str) -> Any: def tags(self) -> list[dict[str, str]]: """Get a list of tags for project.""" - return self.internal_api(f"projects/{self.project_id}/repository/tags") + return self.internal_api(f"projects/{self.project_id}/repository/tags?per_page={ITEMS_LIMIT}" def commits(self) -> list[dict[str, Any]]: """Get a list of commits for project.""" @@ -108,7 +108,7 @@ def commits(self) -> list[dict[str, Any]]: def releases(self) -> list[dict[str, Any]]: """Get a list of releases for project.""" - releases = self.internal_api(f"projects/{self.project_id}/releases") + releases = self.internal_api(f"projects/{self.project_id}/releases?per_page={ITEMS_LIMIT}" retval = [] for release in releases: r = { @@ -163,7 +163,7 @@ def internal_api(self, uri: str): def tags(self) -> list[dict[str, Any]]: """Get a list of tags for project.""" - return self.internal_api(f"repos/{self.project_path}/tags") + return self.internal_api(f"repos/{self.project_path}/tags?limit={ITEMS_LIMIT}" def commits(self) -> list[dict[str, Any]]: """Get a list of commits for project.""" @@ -171,7 +171,7 @@ def commits(self) -> list[dict[str, Any]]: def releases(self) -> list[dict[str, Any]]: """Get a list of releases for project.""" - return self.internal_api(f"repos/{self.project_path}/releases") + return self.internal_api(f"repos/{self.project_path}/releases?limit={ITEMS_LIMIT}" def url_for_ref(self, ref: str, ref_type: RefType) -> str: """Get a URL for a ref."""