Skip to content

Commit 10193a2

Browse files
authored
Fix pydantic 2.5 error
1 parent 4f5b6e1 commit 10193a2

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

enkapy/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ async def fetch_user(self, uid: int, player_only=False) -> EnkaData:
228228

229229
obj: EnkaData = EnkaData.model_validate(data)
230230

231-
if not player_only:
231+
if not player_only and obj.characters:
232232
for character in obj.characters:
233233
if character.skill_depot_id in self._skill_depot_data:
234234
depot = self._skill_depot_data[character.skill_depot_id]

enkapy/model/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import List
1+
from typing import List, Optional
22

33
from pydantic import BaseModel, Field
44

@@ -10,6 +10,6 @@ class EnkaData(BaseModel):
1010
"""All data about the player"""
1111
player: PlayerInfo = Field({}, alias="playerInfo")
1212
"""Basic player info"""
13-
characters: List[CharacterInfo] = Field([], alias="avatarInfoList")
13+
characters: Optional[List[CharacterInfo]] = Field([], alias="avatarInfoList")
1414
"""Player characters shown in game"""
1515
ttl: int = 0

enkapy/model/artifact.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def value(self) -> float:
2323

2424

2525
class ArtifactFlat(BaseModel):
26-
itemType: str
26+
equipType: str
2727
"""Artifact equip types
2828
2929
EQUIP_BRACER: flower

enkapy/model/players.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ class PlayerInfo(BaseModel):
2626
"""Player name card background id"""
2727
nickname: Optional[str]
2828
"""Player nickname"""
29-
signature: Optional[str]
29+
signature: Optional[str] = ''
3030
"""Player signature"""
3131
worldLevel: Optional[int]
3232
"""Player world level"""
3333
profilePicture: ProfilePicture
3434
"""Player profile picture"""
3535

36-
showAvatarInfoList: Optional[List[ShowAvatar]]
36+
showAvatarInfoList: Optional[List[ShowAvatar]] = []
3737
"""Player characters shown"""
3838

3939
towerFloorIndex: Optional[int]

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setuptools.setup(
44
name="enka.py",
5-
version="1.1.6",
5+
version="1.1.7",
66
author="pwnless",
77
author_email="[email protected]",
88
description="Library for fetching JSON data from site https://enka.network/",

0 commit comments

Comments
 (0)