Skip to content

Commit 76992aa

Browse files
Fixed issue with sdk attribute returns None in nested models. (#4)
1 parent a06bb8e commit 76992aa

File tree

5 files changed

+508
-0
lines changed

5 files changed

+508
-0
lines changed

src/tcgdexsdk/utils.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ def _urlopen(url: str, _: float) -> str:
3131
def _from_dict(cls: Type[_TM], data: dict, tcgdex) -> _TM:
3232
self = from_dict(cls, data)
3333
self.sdk = tcgdex
34+
35+
for _, attr_value in self.__dict__.items():
36+
if isinstance(attr_value, list):
37+
for item in attr_value:
38+
if hasattr(item, "sdk"):
39+
item.sdk = tcgdex
40+
elif hasattr(attr_value, "sdk"):
41+
attr_value.sdk = tcgdex
42+
3443
return self
3544

3645

0 commit comments

Comments
 (0)