File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -475,6 +475,11 @@ async def _playtime_update(self):
475475 player_stats = await stats .get_player_stats (
476476 account .user ["user" ]["players" ][0 ]["uuid" ]
477477 )
478+ if player_stats is None :
479+ self ._playtime_text .value = "Час на сервері: -"
480+ self ._latest_online_text .value = "Останній вхід: -"
481+ await asyncio .sleep (60 )
482+ continue
478483 player_stats = player_stats .get ("info" , {})
479484 playtime = player_stats .get ("playtime" , "0" )
480485 last_seen = player_stats .get ("last_seen" , "Ніколи" )
Original file line number Diff line number Diff line change @@ -17,10 +17,13 @@ async def get_player_stats(self, uuid: str):
1717 params = {"player" : uuid }
1818 )
1919 # Raise an error if the request was unsuccessful
20- if response .status_code == 403 :
20+ if response .status_code != 200 :
2121 # rate limit exceeded
2222 return None
23- return response .json ()
23+ try :
24+ return response .json ()
25+ except Exception :
26+ return None
2427
2528
2629stats = Stats ()
You can’t perform that action at this time.
0 commit comments