1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

tracer bugfix

This commit is contained in:
Steffo 2018-08-28 17:53:58 +02:00
parent 942cafd644
commit 15e94bbd83

4
db.py
View file

@ -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"]