diff --git a/espn_api/football/player.py b/espn_api/football/player.py index 392ba79f..635325ca 100644 --- a/espn_api/football/player.py +++ b/espn_api/football/player.py @@ -23,6 +23,8 @@ def __init__(self, data, year): player = data['playerPoolEntry']['player'] if 'playerPoolEntry' in data else data['player'] self.injuryStatus = player.get('injuryStatus', self.injuryStatus) self.injured = player.get('injured', False) + self.percent_owned = round(player.get('ownership', {}).get('percentOwned', -1), 2) + self.percent_started = round(player.get('ownership', {}).get('percentStarted', -1), 2) player_stats = player.get('stats', []) for stats in player_stats: diff --git a/tests/football/unit/test_league.py b/tests/football/unit/test_league.py index 3ae946be..d1cb9004 100644 --- a/tests/football/unit/test_league.py +++ b/tests/football/unit/test_league.py @@ -265,6 +265,8 @@ def test_player_info(self, m): player = league.player_info('James Conner') self.assertEqual(player.name, 'James Conner') self.assertEqual(player.stats[1]['points'], 10.5) + self.assertEqual(player.percent_owned, 96.73) + self.assertEqual(player.percent_started, 73.87)