From 6d347d792804d8a97a46f4497faae9f05ddaeafb Mon Sep 17 00:00:00 2001 From: Tom Kralidis Date: Mon, 20 Apr 2026 05:53:28 -0400 Subject: [PATCH 1/2] delegate HTTP 401 and 403 to Python requests (#1033) --- owslib/util.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/owslib/util.py b/owslib/util.py index ab6c762b..dadc82cc 100644 --- a/owslib/util.py +++ b/owslib/util.py @@ -208,10 +208,10 @@ def openURL(url_base, data=None, method='Get', cookies=None, username=None, pass req = requests.request(method.upper(), url_base, headers=headers, **rkwargs) - if req.status_code in [400, 401, 403]: + if req.status_code == 400: raise ServiceException(req.text) - if req.status_code in [404, 500, 502, 503, 504]: # add more if needed + if req.status_code in [401, 403, 404, 500, 502, 503, 504]: # add more if needed req.raise_for_status() # check for service exceptions without the http header set From 463822bc9d2ff810c9a247d2df6c96ea1e5e3d0d Mon Sep 17 00:00:00 2001 From: Tom Kralidis Date: Mon, 20 Apr 2026 06:03:28 -0400 Subject: [PATCH 2/2] fix tests --- tests/test_ogcapi_records_pycsw.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_ogcapi_records_pycsw.py b/tests/test_ogcapi_records_pycsw.py index b7c6b717..1db211ed 100644 --- a/tests/test_ogcapi_records_pycsw.py +++ b/tests/test_ogcapi_records_pycsw.py @@ -40,7 +40,7 @@ def test_ogcapi_records_pycsw(): assert isinstance(w.response, dict) pycsw_cite_demo_queryables = w.collection_queryables('metadata:main') - assert len(pycsw_cite_demo_queryables['properties'].keys()) == 18 + assert len(pycsw_cite_demo_queryables['properties'].keys()) == 19 # Minimum of limit param is 1 with pytest.raises(RuntimeError):