Skip to content

Commit

Permalink
Fix KeyErrors when Valve bugs out
Browse files Browse the repository at this point in the history
  • Loading branch information
Gobot1234 committed Jul 20, 2023
1 parent d4df5dd commit 2bfb468
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion steam/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,7 @@ class AppInfo(ProductInfo, PartialApp[str]):
"logo",
"website_url",
"parent",
"demo_of_app",
"_stats_visible",
"_free",
"_on_windows",
Expand Down Expand Up @@ -965,6 +966,7 @@ def __init__(
"""This app's website URL."""
self.parent = PartialApp(state, id=int(common["parent"])) if "parent" in common else None
"""This app's parent."""
self.demo_of_app = PartialApp(state, id=int(extended["demoofappid"])) if "demoofappid" in extended else None

depots: manifest.Depot = data.get("depots", MultiDict()) # type: ignore
self._branches: dict[str, Branch] = {}
Expand Down Expand Up @@ -1014,7 +1016,11 @@ def __init__(
int(public_manifest_info if isinstance(public_manifest_info, str) else public_manifest_info["gid"])
)
for branch_name, manifest_info in manifests.items():
branch = self._branches[branch_name]
try:
branch = self._branches[branch_name]
except KeyError:
log.debug("Got a manifest %s that has no associated branch", manifest_info)
continue
manifest_id = manifest_info if isinstance(manifest_info, str) else manifest_info["gid"]
if not branch.password_required:
manifest = ManifestInfo(
Expand Down
3 changes: 3 additions & 0 deletions steam/types/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ class Extended(TypedVDFDict, total=False):
isfreeapp: VDFBool
listofdlc: str
homepage: str
demoofappid: VDFInt
developer: str
publisher: str


class Manifest(TypedVDFDict, total=False):
Expand Down

0 comments on commit 2bfb468

Please sign in to comment.