From e5cdc8faead268f426cbeeddec460ffec252b4e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Gl=C3=BCpker?= Date: Mon, 4 Jun 2018 20:05:31 +0200 Subject: Sanitize player input At least this one field for now. Found a player without lastlogoff time set. --- SteamAPI.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'SteamAPI.py') 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.') -- cgit v1.2.3