From 15e94bbd835d5a937940d42bf25ee8d54debd352 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 28 Aug 2018 17:53:58 +0200 Subject: [PATCH] tracer bugfix --- db.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/db.py b/db.py index 3029f796..7f69015a 100644 --- a/db.py +++ b/db.py @@ -571,11 +571,13 @@ class Overwatch(Base): j = r.json()["eu"]["stats"].get("competitive") if j is None: raise RequestError("Something went wrong when retrieving the stats.") + if not j["game_stats"]: + raise RequestError("Something went wrong when retrieving the stats.") j = j["overall_stats"] except TypeError: raise RequestError("Something went wrong when retrieving the stats.") try: - self.icon = re.search(r"https://.+\.cloudfront\.net/game/unlocks/(0x[0-9A-F]+)\.png", j.get("avatar", "")).group(1) + self.icon = re.search(r"https://.+\.cloudfront\.net/game/unlocks/(0x[0-9A-F]+)\.png", j["avatar"]).group(1) except AttributeError: pass self.level = j["prestige"] * 100 + j["level"]