Skip to content

Commit

Permalink
enh: add support for sportId to player_stat_data() #87
Browse files Browse the repository at this point in the history
  • Loading branch information
toddrob99 committed Aug 10, 2022
1 parent 21ff015 commit 8991668
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions statsapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1120,11 +1120,19 @@ def player_stats(personId, group="[hitting,pitching,fielding]", type="season"):
return stats


def player_stat_data(personId, group="[hitting,pitching,fielding]", type="season"):
def player_stat_data(
personId, group="[hitting,pitching,fielding]", type="season", sportId=1
):
"""Returns a list of current season or career stat data for a given player."""
params = {
"personId": personId,
"hydrate": "stats(group=" + group + ",type=" + type + "),currentTeam",
"hydrate": "stats(group="
+ group
+ ",type="
+ type
+ ",sportId="
+ str(sportId)
+ "),currentTeam",
}
r = get("person", params)

Expand Down

0 comments on commit 8991668

Please sign in to comment.