From b6ef87b8a481c0c4287fa3224bfa773e69fd4d89 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sat, 12 Sep 2020 02:25:06 +0200 Subject: [PATCH] Do not skip private steam profiles but set their properties to 0 instead (fixes #40) --- royalpack/commands/steampowered.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/royalpack/commands/steampowered.py b/royalpack/commands/steampowered.py index 110ea52c..4fc374f4 100644 --- a/royalpack/commands/steampowered.py +++ b/royalpack/commands/steampowered.py @@ -77,14 +77,14 @@ class SteampoweredCommand(LinkerCommand): obj.primary_clan_id = r["primaryclanid"] obj.account_creation_date = datetime.datetime.fromtimestamp(r["timecreated"]) response = await self._call(self._api.IPlayerService.GetSteamLevel_v1, steamid=obj.steamid.as_64) - obj.account_level = response["response"]["player_level"] + obj.account_level = response["response"].get("player_level", 0) response = await self._call(self._api.IPlayerService.GetOwnedGames_v1, steamid=obj.steamid.as_64, include_appinfo=False, include_played_free_games=True, include_free_sub=False, appids_filter=None) - obj.owned_games_count = response["response"]["game_count"] + obj.owned_games_count = response["response"].get("game_count", 0) if response["response"]["game_count"] >= 0: obj.most_played_game_2weeks = sorted(response["response"]["games"], key=lambda g: -g.get("playtime_2weeks", 0))[0]["appid"] obj.most_played_game_forever = sorted(response["response"]["games"], key=lambda g: -g.get("playtime_forever", 0))[0]["appid"]