forked from phoenix/litellm-mirror
fix: dynamo_db.py
handle permissions row
This commit is contained in:
parent
cd8d35107b
commit
34fce00960
2 changed files with 11 additions and 5 deletions
|
@ -282,7 +282,12 @@ class DynamoDBWrapper(CustomDB):
|
||||||
new_response = {}
|
new_response = {}
|
||||||
for k, v in response.items(): # handle json string
|
for k, v in response.items(): # handle json string
|
||||||
if (
|
if (
|
||||||
(k == "aliases" or k == "config" or k == "metadata")
|
(
|
||||||
|
k == "aliases"
|
||||||
|
or k == "config"
|
||||||
|
or k == "metadata"
|
||||||
|
or k == "permissions"
|
||||||
|
)
|
||||||
and v is not None
|
and v is not None
|
||||||
and isinstance(v, str)
|
and isinstance(v, str)
|
||||||
):
|
):
|
||||||
|
|
|
@ -1013,7 +1013,10 @@ async def update_database(
|
||||||
valid_token.spend = new_spend
|
valid_token.spend = new_spend
|
||||||
user_api_key_cache.set_cache(key=token, value=valid_token)
|
user_api_key_cache.set_cache(key=token, value=valid_token)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
verbose_proxy_logger.info(f"Update Key DB Call failed to execute")
|
traceback.print_exc()
|
||||||
|
verbose_proxy_logger.info(
|
||||||
|
f"Update Key DB Call failed to execute - {str(e)}"
|
||||||
|
)
|
||||||
|
|
||||||
### UPDATE SPEND LOGS ###
|
### UPDATE SPEND LOGS ###
|
||||||
async def _insert_spend_log_to_db():
|
async def _insert_spend_log_to_db():
|
||||||
|
@ -1656,9 +1659,7 @@ async def generate_key_helper_fn(
|
||||||
saved_token["config"] = json.loads(saved_token["config"])
|
saved_token["config"] = json.loads(saved_token["config"])
|
||||||
if isinstance(saved_token["metadata"], str):
|
if isinstance(saved_token["metadata"], str):
|
||||||
saved_token["metadata"] = json.loads(saved_token["metadata"])
|
saved_token["metadata"] = json.loads(saved_token["metadata"])
|
||||||
if saved_token["permissions"] is not None and isinstance(
|
if isinstance(saved_token["permissions"], str):
|
||||||
saved_token["permissions"], str
|
|
||||||
):
|
|
||||||
saved_token["permissions"] = json.loads(saved_token["permissions"])
|
saved_token["permissions"] = json.loads(saved_token["permissions"])
|
||||||
if saved_token.get("expires", None) is not None and isinstance(
|
if saved_token.get("expires", None) is not None and isinstance(
|
||||||
saved_token["expires"], datetime
|
saved_token["expires"], datetime
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue