From 00a8d80eab6c7f27814149cb3a7c055ca1480c2b Mon Sep 17 00:00:00 2001 From: jdsika Date: Tue, 20 Oct 2026 19:39:03 +0200 Subject: [PATCH] fix: read w3id namespaces from ids/ after upstream move On 2026-09-04 perma-id/w3id.org moved every namespace directory from the repository root into ids/ (upstream commit 94ed72fc). from_w3id() still listed the root tree, so it returned only docs, ids and tools. A refresh would overwrite w3id.csv with those three rows, and tests/test_etl/test_w3id.py fails with KeyError 'kgcl'. List git/trees/master:ids instead. Also check the HTTP status before parsing JSON. The old error branch called .message on a dict, which turned any non-200 response (rate limit, or a future 404 if ids/ moves) into an AttributeError. Signed-off-by: jdsika --- src/prefixmaps/ingest/ingest_w3id.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/prefixmaps/ingest/ingest_w3id.py b/src/prefixmaps/ingest/ingest_w3id.py index 7a8bdf9..324bf20 100644 --- a/src/prefixmaps/ingest/ingest_w3id.py +++ b/src/prefixmaps/ingest/ingest_w3id.py @@ -2,21 +2,23 @@ from prefixmaps.datamodel.context import Context -API_LIST_CALL = "https://api.github.com/repos/perma-id/w3id.org/git/trees/master" +API_LIST_CALL = "https://api.github.com/repos/perma-id/w3id.org/git/trees/master:ids" def from_w3id() -> Context: """ Creates a Context from the https://github.com/perma-id/w3id.org/. + Each directory under ``ids/`` in that repository is served as ``https://w3id.org//``. + :return: """ import requests r = requests.get(API_LIST_CALL) - results = r.json() if r.status_code != 200: - raise ValueError(results.message) + raise ValueError(f"{API_LIST_CALL} returned {r.status_code}: {r.text}") + results = r.json() if results["truncated"]: raise ValueError("truncated results") ctxt = Context("w3id")