Skip to content

Commit 9bc6b37

Browse files
committed
fix(model) more robust parser for made choices
1 parent 76026dd commit 9bc6b37

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/model/subscription.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,10 @@ def __init__(self, data: dict):
220220

221221
@property
222222
def content_choices_made(self) -> t.List[str]:
223-
if self._content_choices_made:
224-
return self._content_choices_made['initial']['choices_made']
225-
return []
223+
try:
224+
return self._content_choices_made['initial']['choices_made'] # type: ignore
225+
except (KeyError, TypeError):
226+
return []
226227

227228
@property
228229
def remaining_choices(self) -> t.Optional[int]:

src/webservice.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ async def get_subscription_products_with_gamekeys(self) -> t.AsyncGenerator[dict
127127
128128
Every product includes only A FEW representative games from given subscription and other data.
129129
For Choice: `gamekey` field presence means user has unlocked that month to make choices;
130-
`contentChoicesMade` field contain choosen games grouped by keys from "unlockedContentEvents".
131-
For Monhly: `download_url` field presence means user has subscribed this month.
130+
`contentChoicesMade` field contain chosen games grouped by keys from "unlockedContentEvents".
131+
For Monthly: `download_url` field presence means user has subscribed this month.
132132
133133
Yields list of products - historically backward subscriptions info.
134134
Choice products are in form of:

0 commit comments

Comments
 (0)