pwhl_api is a client for APIs used by thepwhl.com to retrieve statistics for PWHL league teams and personnel.
This client is based on the work done by Swar Patel and other contributors on nba_api, a similar package for endpoints on nba.com. Further, in the process of creating endpoints for this client, Isabelle Lefebvre's write-up regarding the https://lscluster.hockeytech.com/feed/ endpoints used on the PWHL site was used for identification and validation.
pwhl_api requires Python version 3.10 or higher, and can be installed through pip using the following command:
pip install pwhl_api# Getting team information by id
from pwhl_api.static.teams import get_team, get_team_by_name
get_team("2")Expected output:
{'id': '2',
'name': 'Minnesota Frost',
'nickname': 'Frost',
'team_code': 'MIN',
'division_id': '1',
'logo': 'https://assets.leaguestat.com/pwhl/logos/50x50/2.png'}# Getting team information by name
get_team_by_name("Boston Fleet")Expected output:
{'id': '1',
'name': 'Boston Fleet',
'nickname': 'Fleet',
'team_code': 'BOS',
'division_id': '1',
'logo': 'https://assets.leaguestat.com/pwhl/logos/50x50/1.png'}from pwhl_api.endpoints.teamroster import TeamRoster
roster = TeamRoster(team_id="2", season="8") # team: Minnesota Frost, season: 2025-26 Regular
roster_dfs = roster.get_data_frames()
roster_dfs['Forwards'].head(5)shoots hometown player_id birthdate tp_jersey_number position \
0 R Mississauga, ON 265 2001-03-02 3 F
1 R Amherst, NY 191 2001-01-16 6 F
2 R Andover, MN 102 1999-09-24 7 F
3 R Atlanta, GA 194 2001-09-20 11 F
4 R Plymouth, MN 23 1995-12-29 12 F
name
0 Alyssa Machado
1 Katy Knoll
2 Claire Butorac
3 Kaitlyn O'Donohoe
4 Kelly Pannek