diff --git a/espn_api/football/player.py b/espn_api/football/player.py index 2ac0a018..c099afa9 100644 --- a/espn_api/football/player.py +++ b/espn_api/football/player.py @@ -27,6 +27,7 @@ def __init__(self, data, year): self.percent_owned = round(player.get('ownership', {}).get('percentOwned', -1), 2) self.percent_started = round(player.get('ownership', {}).get('percentStarted', -1), 2) + self.active_status = 'bye' player_stats = player.get('stats', []) for stats in player_stats: if stats.get('seasonId') != year: @@ -49,5 +50,12 @@ def __init__(self, data, year): self.avg_points = self.stats.get(0, {}).get('avg_points', 0) self.projected_avg_points = self.stats.get(0, {}).get('projected_avg_points', 0) + if not stat_source: + if not self.stats[scoring_period][breakdown_type]: + self.active_status = 'inactive' + else: + self.active_status = 'active' + + def __repr__(self): return f'Player({self.name})'