From 565bbf68e3bca1eb27a8423abd4e309b4c2fc335 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 24 Sep 2018 20:46:38 +0200 Subject: [PATCH] Prevent sending 90000 events to Sentry --- db.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/db.py b/db.py index 14349eb7..6f1bdf31 100644 --- a/db.py +++ b/db.py @@ -160,7 +160,7 @@ class Steam(Base): else: return f"{int(steam_id) - 76561197960265728}" - def update(self): + def update(self, raise_if_private: bool=False): r = requests.get(f"https://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key={config['Steam']['api_key']}&steamids={self.steam_id}") if r.status_code != 200: raise RequestError(f"Steam returned {r.status_code}") @@ -174,7 +174,9 @@ class Steam(Base): if "response" not in j \ or "games" not in j["response"] \ or len(j["response"]["games"]) < 1: - raise RequestError(f"Game data is private") + if raise_if_private: + raise RequestError(f"Game data is private") + return self.most_played_game_id = j["response"]["games"][0]["appid"]