summaryrefslogtreecommitdiff
path: root/SteamAPI.py
diff options
context:
space:
mode:
authorAndré Glüpker <git@wgmd.de>2018-04-19 19:48:18 +0200
committerAndré Glüpker <git@wgmd.de>2018-04-19 19:48:18 +0200
commit589fba63c8d79ffe95d1155601f451b7ffa09bee (patch)
tree858e71e234acaf2df74057902f6759c834ef2d9c /SteamAPI.py
parent2a4ef0f24816f4c736efe8b355f6f338514b6293 (diff)
downloadsteam-589fba63c8d79ffe95d1155601f451b7ffa09bee.tar.gz
steam-589fba63c8d79ffe95d1155601f451b7ffa09bee.tar.bz2
steam-589fba63c8d79ffe95d1155601f451b7ffa09bee.zip
Support not being able to fetch owned games
Since steam privacy setting allows players to hide their library, the code broke, when there was no data :/
Diffstat (limited to 'SteamAPI.py')
-rw-r--r--SteamAPI.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/SteamAPI.py b/SteamAPI.py
index e6548fc..c71f438 100644
--- a/SteamAPI.py
+++ b/SteamAPI.py
@@ -337,8 +337,9 @@ class SteamAPI():
profiles[steamid]['_friends'] = futures['friends'][steamid].result()
profiles[steamid]['_userstats'] = futures['userstats'][steamid].result()
profiles[steamid]['_ownedGames'] = futures['ownedGames'][steamid].result()
- profiles[steamid]['_ownedPlayedGames'] = len([game for game in profiles[steamid]['_ownedGames']['games'] if game['playtime_forever'] > 0])
-
+ profiles[steamid]['_ownedPlayedGames'] = 'n/a'
+ if profiles[steamid]['_ownedGames']:
+ profiles[steamid]['_ownedPlayedGames'] = len([game for game in profiles[steamid]['_ownedGames']['games'] if game['playtime_forever'] > 0])
return profiles