Fix "avatarId" and "reliquarySubstats" not founded

This commit is contained in:
M-307 2022-07-29 12:26:48 +07:00
parent bb78e8aa7c
commit a36ca4ad5f
2 changed files with 8 additions and 7 deletions

View File

@ -59,7 +59,7 @@ class EquipmentsDetail(BaseModel):
__pydantic_self__.icon = Assets.create_icon_path(data["icon"])
__pydantic_self__.artifact_type = EquipType(data["equipType"]).name
# Sub Stats
for stats in data["reliquarySubstats"]:
for stats in data["reliquarySubstats"] if "reliquarySubstats" in data else []:
__pydantic_self__.substats.append(
EquipmentsStats.parse_obj(stats))

View File

@ -1,7 +1,7 @@
import logging
from pydantic import BaseModel, Field
from typing import List, Any
from typing import List, Any, Union
from ..assets import Assets
@ -17,13 +17,14 @@ class ProfilePicture(BaseModel):
"""
Custom add data
"""
url: str = ""
url: Union[str, None] = None
def __init__(__pydantic_self__, **data: Any) -> None:
super().__init__(**data)
# Get character
LOGGER.debug("=== Avatar ===")
if "avatarId" in data:
icon = Assets.character_icon(str(data["avatarId"]))
if not icon: