summaryrefslogtreecommitdiff
path: root/SteamAPI.py
diff options
context:
space:
mode:
authorAndré Glüpker <git@wgmd.de>2018-06-04 20:05:31 +0200
committerAndré Glüpker <git@wgmd.de>2018-06-04 20:05:31 +0200
commite5cdc8faead268f426cbeeddec460ffec252b4e0 (patch)
tree0b68ee2b3cc11a63facb11616baffdb60099797f /SteamAPI.py
parent5c5a33d4319843b1840bbf61e8373b3f9b8f57ab (diff)
downloadsteam-e5cdc8faead268f426cbeeddec460ffec252b4e0.tar.gz
steam-e5cdc8faead268f426cbeeddec460ffec252b4e0.tar.bz2
steam-e5cdc8faead268f426cbeeddec460ffec252b4e0.zip
Sanitize player input
At least this one field for now. Found a player without lastlogoff time set.
Diffstat (limited to 'SteamAPI.py')
-rw-r--r--SteamAPI.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/SteamAPI.py b/SteamAPI.py
index a992e68..63b79c6 100644
--- a/SteamAPI.py
+++ b/SteamAPI.py
@@ -88,6 +88,7 @@ class SteamAPI():
for player in jsondata['response']['players']:
currentid = player['steamid']
+ self.sanitizePlayer(player)
profile[currentid] = player
if CACHE:
@@ -346,6 +347,11 @@ class SteamAPI():
return profiles
+ @staticmethod
+ def sanitizePlayer(player):
+ if 'lastlogoff' not in player:
+ player['lastlogoff'] = -1
+
if __name__ == "__main__":
# TODO(andre): Maybe run tests here?
print('This is a module.')