1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-24 03:54:20 +00:00

Prevent sending 90000 events to Sentry

This commit is contained in:
Steffo 2018-09-24 20:46:38 +02:00
parent 092d286a56
commit 565bbf68e3

6
db.py
View file

@ -160,7 +160,7 @@ class Steam(Base):
else: else:
return f"{int(steam_id) - 76561197960265728}" 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}") 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: if r.status_code != 200:
raise RequestError(f"Steam returned {r.status_code}") raise RequestError(f"Steam returned {r.status_code}")
@ -174,7 +174,9 @@ class Steam(Base):
if "response" not in j \ if "response" not in j \
or "games" not in j["response"] \ or "games" not in j["response"] \
or len(j["response"]["games"]) < 1: 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"] self.most_played_game_id = j["response"]["games"][0]["appid"]