GayathriSrividya commented on code in PR #3423:
URL: https://github.com/apache/iceberg-python/pull/3423#discussion_r3351932925
##########
pyiceberg/catalog/rest/__init__.py:
##########
@@ -435,7 +436,32 @@ def _create_session(self) -> Session:
elif ssl_client_cert := ssl_client.get(CERT):
session.cert = ssl_client_cert
- if auth_config := self.properties.get(AUTH):
+ raw_auth = self.properties.get(AUTH)
+ if isinstance(raw_auth, str):
+ try:
+ auth_config: dict[str, Any] | None = json.loads(raw_auth)
+ except json.JSONDecodeError as e:
+ raise ValueError("Failed to parse auth configuration as JSON")
from e
+ elif raw_auth is not None:
+ auth_config = raw_auth
+ elif auth_type := self.properties.get(f"{AUTH}.type"):
+ type_prefix = f"{AUTH}.{auth_type}."
+ auth_config = {
Review Comment:
Thanks for the suggestion — agreed. I added explicit typed auth config
structures and split parsing/validation into typed helper functions so this
path is no longer handled as an untyped dict throughout.
The behavior is unchanged, and existing JSON-string + flat env-var auth
tests still pass after the refactor.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]