From 2bfb468d193d56ec7147418dfd7e51659fc711ae Mon Sep 17 00:00:00 2001 From: Gobot1234 Date: Thu, 20 Jul 2023 16:21:30 +0100 Subject: [PATCH] Fix KeyErrors when Valve bugs out --- steam/manifest.py | 8 +++++++- steam/types/manifest.py | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/steam/manifest.py b/steam/manifest.py index a4a1c755..14bba425 100644 --- a/steam/manifest.py +++ b/steam/manifest.py @@ -881,6 +881,7 @@ class AppInfo(ProductInfo, PartialApp[str]): "logo", "website_url", "parent", + "demo_of_app", "_stats_visible", "_free", "_on_windows", @@ -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] = {} @@ -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( diff --git a/steam/types/manifest.py b/steam/types/manifest.py index 711e40da..5e7f3d4c 100644 --- a/steam/types/manifest.py +++ b/steam/types/manifest.py @@ -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):