From 16db30f496d1da10161eb78196a0a8465b9ed125 Mon Sep 17 00:00:00 2001 From: "Jeremie J. Jarosh" Date: Sat, 15 Apr 2023 13:52:36 -0500 Subject: [PATCH] Fix broken `--download-game` parameter In commit c652516eec390606d81350dd6f6a1c32e52cf747 a check was added to determine if a game was not purchased via the `uploads/` endpoint. Unfortunately that endpoint replaced the call to the game data endpoint that we need to download the game. This adds the game data endpoint call back in. --- itchiodl/library.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/itchiodl/library.py b/itchiodl/library.py index 1132735..d467ffd 100644 --- a/itchiodl/library.py +++ b/itchiodl/library.py @@ -49,11 +49,16 @@ class Library: j = json.loads(rsp.text) game_id = j["id"] gsp = requests.get( - f"https://api.itch.io/games/{game_id}/uploads", + f"https://api.itch.io/games/{game_id}", headers={"Authorization": self.login}, ) k = gsp.json() - if k != {"uploads": {}}: + usp = requests.get( + f"https://api.itch.io/games/{game_id}/uploads", + headers={"Authorization": self.login}, + ) + l = usp.json() + if l != {"uploads": {}}: self.games.append(Game(k)) return print(f"{title} is a purchased game.")