From 570c2b689e92df4c1e9c7b7f5d2bd925783edbad Mon Sep 17 00:00:00 2001 From: Tudor Sitaru Date: Mon, 30 Mar 2026 21:47:14 +0100 Subject: [PATCH] fix(tap-uk-ees): handle plain list response from releases endpoint Co-Authored-By: Claude Sonnet 4.6 --- .../extractors/tap-uk-ees/tap_uk_ees/tap.py | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/pipeline/plugins/extractors/tap-uk-ees/tap_uk_ees/tap.py b/pipeline/plugins/extractors/tap-uk-ees/tap_uk_ees/tap.py index 554824f..0718fc4 100644 --- a/pipeline/plugins/extractors/tap-uk-ees/tap_uk_ees/tap.py +++ b/pipeline/plugins/extractors/tap-uk-ees/tap_uk_ees/tap.py @@ -34,19 +34,12 @@ def get_content_release_id(publication_slug: str) -> str: def get_all_release_ids(publication_slug: str) -> list[str]: """Return all release IDs for a publication, newest first.""" url = f"{CONTENT_API_BASE}/publications/{publication_slug}/releases" - ids = [] - page = 1 - while True: - resp = requests.get(url, params={"page": page, "pageSize": 20}, timeout=TIMEOUT) - resp.raise_for_status() - data = resp.json() - for r in data.get("results", []): - ids.append(r["id"]) - paging = data.get("paging", {}) - if page >= paging.get("totalPages", 1): - break - page += 1 - return ids + resp = requests.get(url, timeout=TIMEOUT) + resp.raise_for_status() + data = resp.json() + # API returns either a plain list or a paginated object with a "results" key + releases = data if isinstance(data, list) else data.get("results", []) + return [r["id"] for r in releases] def download_release_zip(release_id: str) -> zipfile.ZipFile: