1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-24 03:54: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") j = r.json()["eu"]["stats"].get("competitive")
if j is None: if j is None:
raise RequestError("Something went wrong when retrieving the stats.") 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"] j = j["overall_stats"]
except TypeError: except TypeError:
raise RequestError("Something went wrong when retrieving the stats.") raise RequestError("Something went wrong when retrieving the stats.")
try: 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: except AttributeError:
pass pass
self.level = j["prestige"] * 100 + j["level"] self.level = j["prestige"] * 100 + j["level"]