Skip to content

Commit 8991668

Browse files
committed
enh: add support for sportId to player_stat_data() #87
1 parent 21ff015 commit 8991668

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

statsapi/__init__.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,11 +1120,19 @@ def player_stats(personId, group="[hitting,pitching,fielding]", type="season"):
11201120
return stats
11211121

11221122

1123-
def player_stat_data(personId, group="[hitting,pitching,fielding]", type="season"):
1123+
def player_stat_data(
1124+
personId, group="[hitting,pitching,fielding]", type="season", sportId=1
1125+
):
11241126
"""Returns a list of current season or career stat data for a given player."""
11251127
params = {
11261128
"personId": personId,
1127-
"hydrate": "stats(group=" + group + ",type=" + type + "),currentTeam",
1129+
"hydrate": "stats(group="
1130+
+ group
1131+
+ ",type="
1132+
+ type
1133+
+ ",sportId="
1134+
+ str(sportId)
1135+
+ "),currentTeam",
11281136
}
11291137
r = get("person", params)
11301138

0 commit comments

Comments
 (0)