From 8677e471bfaa1ae9dbbf3f014c4127321c74e254 Mon Sep 17 00:00:00 2001 From: Jason Knight <108911221+jck-longhair@users.noreply.github.com> Date: Tue, 20 Oct 2026 17:00:47 +0100 Subject: [PATCH 1/2] fix: accept single-quoted SSO config assignments (#176) --- src/api/hive_api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/api/hive_api.py b/src/api/hive_api.py index 0bf1ba76..cf052d53 100644 --- a/src/api/hive_api.py +++ b/src/api/hive_api.py @@ -18,7 +18,8 @@ # json.JSONDecodeError subclass. _REQUEST_ERRORS = (OSError, RuntimeError, json.JSONDecodeError) -_SSO_ASSIGNMENT = re.compile(r'window\.(\w+)\s*=\s*"([^"]*)"') +# The SSO page has used both `window.Key="value",` and `window.Key = 'value';`. +_SSO_ASSIGNMENT = re.compile(r"""window\.(\w+)\s*=\s*["']([^"']*)["']""") class HiveApi: From 3bb18e3ed16c1d005222e961d2e082fb500c1df4 Mon Sep 17 00:00:00 2001 From: Jason Knight <108911221+jck-longhair@users.noreply.github.com> Date: Tue, 20 Oct 2026 17:02:11 +0100 Subject: [PATCH 2/2] fix: accept single-quoted SSO config assignments --- tests/unit/test_hive_api.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/unit/test_hive_api.py b/tests/unit/test_hive_api.py index 4511c104..616f7e26 100644 --- a/tests/unit/test_hive_api.py +++ b/tests/unit/test_hive_api.py @@ -206,6 +206,27 @@ def test_successful_parse_returns_login_data(self): # REGION mirrors UPID assert result["REGION"] == "eu-west-1_abc" + def test_parses_single_quoted_assignments_with_spaces(self): + """Parses the SSO page format in use since October 2026.""" + api = _make_api() + html_content = ( + b"" + ) + mock_resp = MagicMock() + mock_resp.content = html_content + mock_resp.status_code = 200 + + with patch("apyhiveapi.api.hive_api.requests.get", return_value=mock_resp): + result = api.get_login_info() + + assert result is not None + assert result["UPID"] == "eu-west-1_abc" + assert result["CLIID"] == "client123" + assert result["REGION"] == "eu-west-1_abc" + def test_os_error_calls_error_and_raises_connection_error(self): api = _make_api() with (