Skip to main content

Fetch PWHL game schedules from the HockeyTech API

Project description

pwhl-client

Fetch PWHL game schedules from the HockeyTech API. A Python library and CLI tool for developers who want structured, validated schedule data from the Professional Women's Hockey League without dealing with raw API responses.


Install

pip install pwhl-client

Quick start — library

Single date (defaults to today):

from pwhl_client import get_schedule

games = get_schedule()
print(games.to_dict())

Specific date:

from datetime import date
from pwhl_client import get_schedule

games = get_schedule(start=date(2026, 3, 15))
print(games.to_dict())

Date range with timezone:

from datetime import date
from zoneinfo import ZoneInfo
from pwhl_client import get_schedule

games = get_schedule(
    start=date(2026, 3, 15),
    end=date(2026, 3, 22),
    tz=ZoneInfo("America/New_York"),
)
for game in games.games:
    print(game.home_team, "vs", game.visiting_team, "@", game.game_datetime)

Quick start — CLI

# Today's games
pwhl-client

# Specific date
pwhl-client 2026-03-15

# Specific date with timezone
pwhl-client 2026-03-15 --tz America/New_York

Configuration

PWHL_API_KEY defaults to the current known public value embedded in the PWHL website's JavaScript. You only need to set it if the key rotates.

# .env file (recommended)
PWHL_API_KEY=your_new_key_here

# or shell export
export PWHL_API_KEY=your_new_key_here

PWHL_CLIENT_CODE is hardcoded as "pwhl" — it is a fixed league identifier on the HockeyTech platform and is not user-configurable.


Output shape

ScheduleResult.to_dict() returns:

{
  "fetched_at": "2026-03-15T19:00:00+00:00",
  "game_count": 1,
  "games": [
    {
      "game_id": "12345",
      "game_status": "scheduled",
      "home_team": "Boston Fleet",
      "home_team_id": "1",
      "visiting_team": "Minnesota Frost",
      "visiting_team_id": "2",
      "venue": "Tsongas Center",
      "city": "Lowell",
      "game_datetime": "2026-03-15T19:00:00-04:00",
      "home_goal_count": null,
      "visiting_goal_count": null
    }
  ]
}

game_status is one of "scheduled", "in_progress", "completed", or "unknown". game_datetime is always timezone-aware and stored in the timezone passed to get_schedule(). home_goal_count and visiting_goal_count are null for pre-game entries.


Exceptions

pwhl-client raises the following exceptions:

  • PWHLAPIError — raised on network failure, timeout, or a non-2xx HTTP response from the HockeyTech API.
  • PWHLParseError (subclass of PWHLAPIError) — raised when the API returns a response that cannot be parsed or does not match the expected shape.
  • ValueError — raised when start is after end.

Catch PWHLAPIError to handle both API and parse failures in one place:

from pwhl_client import get_schedule, PWHLAPIError

try:
    result = get_schedule()
except PWHLAPIError as e:
    print(f"Could not fetch schedule: {e}")

Data source

Game data is fetched from the HockeyTech/LeagueStat API, the undocumented backend that powers thepwhl.com. The API has been reverse-engineered and documented by the community — see the PWHL Data Reference repository for full details on available endpoints and parameters.


License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pwhl_client-0.1.0.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pwhl_client-0.1.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file pwhl_client-0.1.0.tar.gz.

File metadata

  • Download URL: pwhl_client-0.1.0.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pwhl_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4896a29580cef7ce6191b7a1c61959727e2dd5f1b9d47192ddf150ad0c9c0d72
MD5 2401bd2ee5fac233b8e335addbe96572
BLAKE2b-256 f6865082e9976ab6b5241ed33b8c1297919e80fc65e19575aa7c065bf2cb302b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pwhl_client-0.1.0.tar.gz:

Publisher: publish.yml on jgalloway42/pwhl-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pwhl_client-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pwhl_client-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pwhl_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8de418b46a64e9d5b4bd4bc18995c0bf0b153f3aeba1daf7223e1abf6c425edf
MD5 5080acc5122018f6859107fbc36f1eee
BLAKE2b-256 c8079671fa77afbd145a6b4d347565414ea2940acb3b610bf5ae24bd388ba2ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for pwhl_client-0.1.0-py3-none-any.whl:

Publisher: publish.yml on jgalloway42/pwhl-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page