mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-04 02:31:27 +00:00
(sap) fix after bot review
This commit is contained in:
parent
b38bd57be6
commit
10054617b5
1 changed files with 11 additions and 2 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue