EdgingHockeyScraper
https://pypi.python.org/pypi/edginghockeyscraper
Install
pip install edginghockeyscraper
Python Hockey Data Scraper
- Free software: MIT license
- Documentation: https://edginghockeyscraper.readthedocs.io.
Features
-
Python Hockey Data Scraper with following features:
- Caching Requests to quickly fetch data
- Parallel Processing to speed up data fetch from NHL API
-
Get League schedule for year - Usage
schedule = edginghockeyscraper.get_league_schedule(2024) -
Get Game boxscore
boxscore = edginghockeyscraper.get_boxscore(2024020345)
-
Get Game playByPlay
playByPlay = edginghockeyscraper.get_play_by_play(2024020345)
-
Get Season boxscores
boxscoreSeason = edginghockeyscraper.get_boxscore_season(2024)
-
Get Season playByPlay
playByPlaySeason = edginghockeyscraper.get_play_by_play_season(2024)
Filter Season data by PreSeason, Regular, PostSeason gametypes
- e.g.
games = edginghockeyscraper.get_league_schedule(2024, {GameType.REG})boxscoreSeason = edginghockeyscraper.get_boxscore_season(2024, {GameType.REG})
Fetch multiple seasons in one pooled call
- Season-range variants of the fetchers above pull the schedule for each season, then issue a single pooled fetch across every game in the range instead of spinning up a new worker pool per season:
boxscoreSeasons = edginghockeyscraper.get_boxscore_seasons(range(2020, 2025))playByPlaySeasons = edginghockeyscraper.get_play_by_play_seasons(range(2020, 2025))shiftsSeasons = edginghockeyscraper.get_shifts_seasons(range(2020, 2025))onIcePbpSeasons = edginghockeyscraper.get_on_ice_players_with_play_by_play_seasons(range(2020, 2025))stintsSeasons = edginghockeyscraper.build_stints_seasons(range(2020, 2025))
- Prefer these over looping the single-season functions when backfilling a range of seasons (e.g. building an xG training set) -- one pool for the whole range instead of one per season.
Choose a fetch backend
- All season and multi-season fetchers accept
fetch_backend('process'or'thread', default'process') andmax_workers:boxscoreSeason = edginghockeyscraper.get_boxscore_season(2024, fetch_backend='thread', max_workers=16)
'process'matches historical behavior (CPU-isolated workers), and suits cases with heavier per-game post-processing (e.g.build_stints_season/build_stints_seasons).'thread'is often faster for the pure single-endpoint fetchers (get_boxscore,get_play_by_play,get_shifts,get_on_ice_players_with_play_by_play) since each call is a blocking HTTP GET + JSON parse -- I/O-bound work that releases the GIL while waiting on the network, and threads skip the cost of pickling large payloads back across a process boundary. Benchmark on your own connection/CPU before assuming thread is faster -- it depends on how much the NHL API rate-limits concurrent connections, and requests-cache's sqlite backend serializes writes from many threads in one process, which can become the bottleneck at high thread counts.max_workers=None(the default) keeps each backend's own default (process_map->os.cpu_count();thread_map->min(32, os.cpu_count() + 4)).
Utilize requests-cache for fast repeated request calls
- Caching is on by default; pass
disable_cache=Trueto bypass it.
-
First Call:
%%time edginghockeyscraper.get_boxscore_season(2024)CPU times: user 583 ms, sys: 318 ms, total: 901 ms Wall time: 1min 18s -
Second Call:
CPU times: user 374 ms, sys: 141 ms, total: 515 ms Wall time: 1.31 s
A 60x speedup!
Utilize multiprocessing to improve request speed
Benchmark using 2024 Macbook Air Apple M3 16GB
-
No Parallel getBoxscoreSeason:
CPU times: user 15.6 s, sys: 3.55 s, total: 19.1 s Wall time: 8min 49s -
Parallel getBoxscoreSeason:
CPU times: user 583 ms, sys: 318 ms, total: 901 ms Wall time: 1min 18sA ~7x Speedup! (this is an 8-core CPU - you can expect roughly a <# cpu-cores> speedup)
Release files for edginghockeyscraper 0.1.16
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| edginghockeyscraper-0.1.16.tar.gz | 27.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| edginghockeyscraper-0.1.16-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 45.3 kB
Release files / edginghockeyscraper-0.1.16.tar.gz
| Download URL | edginghockeyscraper-0.1.16.tar.gz |
|---|---|
| Size | 27.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5443bae1ab9bd16388572840998ea4cf2d3f3a9786dd4052259d8c9933ae9794
|
|
BLAKE2b-256 checksum How to use checksums |
e76da9f41adc4117c4c59791970e07b5453c002f34aa5ca0eee867708641b173
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 16, 2026.
Transparency logRelease files / edginghockeyscraper-0.1.16-py3-none-any.whl
| Download URL | edginghockeyscraper-0.1.16-py3-none-any.whl |
|---|---|
| Size | 17.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
be82255436edcb04ee8b59e3b548c48f588e140181c6f903e1ddcc752937148c
|
|
BLAKE2b-256 checksum How to use checksums |
b9a2119c103005552772d987a68e029a6fcd7620d60baccfa0018bdfb05b6d4a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 16, 2026.
Transparency log