diff --git a/get_data.py b/get_data.py index e28276a..dcff8c1 100644 --- a/get_data.py +++ b/get_data.py @@ -1313,7 +1313,7 @@ async def referee(): @app.get("/team_comparison.json") async def team_comparison(): - try: + if STATUS not in ["no_game_today", "finished_today"]: data = latest_data["pregame"]["data"]["result"] teams = [] for data_team in (data["teamStats1"], data["teamStats2"]): @@ -1383,8 +1383,8 @@ async def team_comparison(): } teams.append(temp_team) return teams - except TypeError: - return {"Данных о сравнении команд нет!"} + else: + return [{"Данных о сравнении команд нет!"}] @@ -1462,7 +1462,10 @@ async def regular_standings(): @app.get("/live_status.json") async def live_status(): - return [latest_data["live-status"]["data"]["result"]] + if STATUS in ["live", "live_soon"]: + return [latest_data["live-status"]["data"]["result"]] + else: + return [{"foulsA": 0, "foulsB": 0}] if __name__ == "__main__":