GayathriSrividya commented on code in PR #3423:
URL: https://github.com/apache/iceberg-python/pull/3423#discussion_r3324270830
##########
pyiceberg/catalog/rest/__init__.py:
##########
@@ -435,7 +436,16 @@ 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):
+ if raw_auth := self.properties.get(AUTH):
+ # When auth is configured via an environment variable (e.g.
PYICEBERG_CATALOG__<NAME>__AUTH),
+ # the value arrives as a JSON string rather than a dict. Decode it
before processing.
+ if isinstance(raw_auth, str):
+ try:
+ auth_config: dict[str, Any] = json.loads(raw_auth)
+ except json.JSONDecodeError as e:
+ raise ValueError(f"Failed to parse auth configuration as
JSON: {raw_auth!r}") from e
+ else:
+ auth_config = raw_auth
auth_type = auth_config.get("type")
Review Comment:
This is now handled! After decoding, the code checks that the result is a
dictionary and raises a ValueError if not. Thanks for the suggestion!
--
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]