From c7d6bbbfad90d4115ff934c8dc93c9a1bf8ae539 Mon Sep 17 00:00:00 2001 From: JS Ng Date: Wed, 7 Oct 2026 15:23:48 +0800 Subject: [PATCH 1/2] fix(json_client): import HttpHeader from campus.webauth.models campus moves its HTTP header models out of campus.model into the new top-level campus.webauth package. CampusRequest.headers annotates and constructs HttpHeader at class-definition time, so the old campus.model.HttpHeader reference breaks against the updated campus-suite@weekly. --- campus_python/json_client/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/campus_python/json_client/__init__.py b/campus_python/json_client/__init__.py index 3797fae..c7904c8 100644 --- a/campus_python/json_client/__init__.py +++ b/campus_python/json_client/__init__.py @@ -13,9 +13,9 @@ from collections.abc import Callable from typing import Any, Mapping, Self, cast -import campus.model import requests from campus.common import env +from campus.webauth.models import HttpHeader from .. import errors from .interface import JsonClient, JsonDict, JsonResponse @@ -47,7 +47,7 @@ def text(self) -> str: def json(self) -> Any: try: return self._response.json() - except ValueError as exc: # JSON decoding error + except ValueError: # JSON decoding error raise errors.MalformedResponseError( error_description="Response is not valid JSON" ) from None @@ -108,10 +108,10 @@ def __init__( self.reset_authorization() @property - def headers(self) -> campus.model.HttpHeader: + def headers(self) -> HttpHeader: """Get the currently configured headers.""" headers = cast(Mapping[str, str], self._session.headers) - return campus.model.HttpHeader.from_header(headers) + return HttpHeader.from_header(headers) def _build_url(self, path: str) -> str: if not self.base_url: # relative URL From d711435f58708724991f20d622303c69c2a0f087 Mon Sep 17 00:00:00 2001 From: JS Ng Date: Wed, 7 Oct 2026 15:30:41 +0800 Subject: [PATCH 2/2] fix(json_client): fall back to campus.model.HttpHeader on older campus-suite The webauth header models only exist from campus#857 onward. Resolve them with a fallback so this client imports against both the locked campus-suite (pre-857) and the updated one, unblocking CI on both sides of the coordinated merge. --- campus_python/json_client/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/campus_python/json_client/__init__.py b/campus_python/json_client/__init__.py index c7904c8..46d4ce5 100644 --- a/campus_python/json_client/__init__.py +++ b/campus_python/json_client/__init__.py @@ -15,7 +15,14 @@ import requests from campus.common import env -from campus.webauth.models import HttpHeader + +try: + from campus.webauth.models import HttpHeader +except ImportError: + # campus-suite predating campus#857 keeps header models in + # campus.model; this fallback lets this client work against both + # the old and the new campus-suite until locks are re-resolved. + from campus.model import HttpHeader from .. import errors from .interface import JsonClient, JsonDict, JsonResponse