mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-27 21:44:21 +00:00
Prevent sending 90000 events to Sentry
This commit is contained in:
parent
092d286a56
commit
565bbf68e3
1 changed files with 4 additions and 2 deletions
4
db.py
4
db.py
|
@ -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:
|
||||||
|
if raise_if_private:
|
||||||
raise RequestError(f"Game data is 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"]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue