(sap) fix after bot review

This commit is contained in:
Vasilisa Parshikova 2026-03-05 15:42:20 +04:00 • committed by Sameer Kankute
parent b38bd57be6
commit 10054617b5
No known key found for this signature in database

View file

@ -33,9 +33,18 @@ def _get_home() -> str:
def _get_nested(d: Union[Dict[str, Any], str], path: Sequence[str]) -> Any:
cur: Any = d
if isinstance(cur, str):
cur = json.loads(cur)
try:
cur = json.loads(cur)
except json.JSONDecodeError:
verbose_logger.warning(
"SAP service key is a string but not valid JSON."
)
return None
for k in path:
if not isinstance(cur, dict) or k not in cur:
verbose_logger.warning(
f"SAP service key has unexpected type '{type(cur).__name__}' (expected dict or JSON string). "
)
return None
cur = cur[k]
return cur
@ -258,7 +267,7 @@ def validate_credentials(
)
def get_token_creator(
service_key: Optional[str] = None,
service_key: Optional[Union[str, dict]] = None,
profile: Optional[str] = None,
*,
expiry_buffer_minutes: int = 60,