puckapi 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
puckapi/client.py ADDED
@@ -0,0 +1,892 @@
1
+ """Generated by packages/python/generate.py from the PuckAPI OpenAPI spec. Do not edit by hand."""
2
+ from __future__ import annotations
3
+
4
+ from typing import Any, Dict, List, Literal, Optional, Union
5
+
6
+ from ._core import BaseClient
7
+
8
+ #: Credits each tool costs, from the spec.
9
+ TOOLS: Dict[str, int] = {
10
+ "get_standings": 2,
11
+ "get_team_stats": 5,
12
+ "list_teams": 1,
13
+ "get_games": 5,
14
+ "get_schedule": 2,
15
+ "get_game_detail": 10,
16
+ "get_head_to_head": 10,
17
+ "search_players": 2,
18
+ "get_player_stats": 5,
19
+ "get_goalie_stats": 5,
20
+ "get_skater_season_stats": 5,
21
+ "get_player_game_log": 5,
22
+ "get_odds": 10,
23
+ "get_line_movement": 25,
24
+ "get_player_props": 10,
25
+ "get_prop_history": 10,
26
+ "get_plays": 10,
27
+ "get_shot_map": 10,
28
+ "get_shifts": 10,
29
+ "get_situation_time": 10,
30
+ }
31
+
32
+
33
+ class Client(BaseClient):
34
+ """Client for the PuckAPI API (NHL).
35
+
36
+ Create one with ``Client()`` (reads PUCKAPI_API_KEY) or ``Client(api_key="...")``.
37
+ Every method returns the unwrapped ``data`` from the response.
38
+ ``last_credits_used`` and ``last_credits_remaining`` hold the counters from
39
+ the most recent response.
40
+ """
41
+
42
+ def get_standings(
43
+ self,
44
+ *,
45
+ conference: Optional[Literal["Eastern", "Western"]] = None,
46
+ division: Optional[str] = None,
47
+ season: Optional[str] = None,
48
+ league: Optional[Literal["nhl", "pwhl", "ohl", "whl", "qmjhl", "echl", "ahl", "ushl"]] = None,
49
+ ) -> Any:
50
+ """Standings.
51
+
52
+ Use when checking where teams rank in their division or conference. Returns points, wins,
53
+ losses, OT losses, point%, goal differential, goals for/against per game, and 5v5 possession:
54
+ Corsi%, Fenwick% and expected goals for and against. The possession columns are 5v5 only, so
55
+ they will not match a goalie's expected goals against, which covers every strength. Defaults to
56
+ the most recent season with standings. Costs 2 credits.
57
+
58
+ Costs 2 credits per call.
59
+
60
+ Args:
61
+ conference (optional): Filter by conference. One of: Eastern, Western.
62
+ division (optional): Filter by division (e.g. Atlantic, Metropolitan, Central, Pacific)
63
+ season (optional): Season ID, 8-digit (e.g. 20242025 for 2024-25). 2024-25 and 2024-2025
64
+ also accepted. Defaults to current season.
65
+ league (optional): League. Defaults to nhl. One of: nhl, pwhl, ohl, whl, qmjhl, echl, ahl,
66
+ ushl.
67
+
68
+ Returns:
69
+ The unwrapped ``data`` object from the response.
70
+ """
71
+ return self._call(
72
+ "get_standings",
73
+ {
74
+ "conference": conference,
75
+ "division": division,
76
+ "season": season,
77
+ "league": league,
78
+ },
79
+ )
80
+
81
+ def get_team_stats(
82
+ self,
83
+ team: str,
84
+ *,
85
+ season: Optional[str] = None,
86
+ league: Optional[Literal["nhl", "pwhl", "ohl", "whl", "qmjhl", "echl", "ahl", "ushl"]] = None,
87
+ ) -> Any:
88
+ """Team stats.
89
+
90
+ Use when you need full details for one team: record, goals for and against, league rank, and 5v5
91
+ possession (Corsi%, Fenwick%, expected goals for and against). Possession is 5v5 only. Requires
92
+ a team abbreviation (use list_teams if unsure). Costs 5 credits.
93
+
94
+ Costs 5 credits per call.
95
+
96
+ Args:
97
+ team: Team abbreviation (e.g. BUF, TOR, NYR)
98
+ season (optional): Season ID, 8-digit (e.g. 20242025 for 2024-25). 2024-25 and 2024-2025
99
+ also accepted. Defaults to current season.
100
+ league (optional): League. Defaults to nhl. One of: nhl, pwhl, ohl, whl, qmjhl, echl, ahl,
101
+ ushl.
102
+
103
+ Returns:
104
+ The unwrapped ``data`` object from the response.
105
+ """
106
+ return self._call(
107
+ "get_team_stats",
108
+ {
109
+ "team": team,
110
+ "season": season,
111
+ "league": league,
112
+ },
113
+ )
114
+
115
+ def list_teams(
116
+ self,
117
+ *,
118
+ conference: Optional[Literal["Eastern", "Western"]] = None,
119
+ division: Optional[str] = None,
120
+ league: Optional[Literal["nhl", "pwhl", "ohl", "whl", "qmjhl", "echl", "ahl", "ushl"]] = None,
121
+ ) -> Any:
122
+ """List teams.
123
+
124
+ Use when you need team abbreviations, or to see all 32 active NHL teams with city, conference,
125
+ division, and arena. Excludes historical franchises (ATL, ARI). Cheapest tool at 1 credit.
126
+
127
+ Costs 1 credit per call.
128
+
129
+ Args:
130
+ conference (optional): Filter by conference. One of: Eastern, Western.
131
+ division (optional): Filter by division
132
+ league (optional): League. Defaults to nhl. One of: nhl, pwhl, ohl, whl, qmjhl, echl, ahl,
133
+ ushl.
134
+
135
+ Returns:
136
+ The unwrapped ``data`` object from the response.
137
+ """
138
+ return self._call(
139
+ "list_teams",
140
+ {
141
+ "conference": conference,
142
+ "division": division,
143
+ "league": league,
144
+ },
145
+ )
146
+
147
+ def get_games(
148
+ self,
149
+ *,
150
+ date_from: Optional[str] = None,
151
+ date_to: Optional[str] = None,
152
+ team: Optional[str] = None,
153
+ season: Optional[str] = None,
154
+ game_state: Optional[Literal["FUT", "LIVE", "FINAL", "OFF"]] = None,
155
+ game_type: Optional[Literal["regular", "playoff", "preseason"]] = None,
156
+ limit: Optional[int] = None,
157
+ league: Optional[Literal["nhl", "pwhl", "ohl", "whl", "qmjhl", "echl", "ahl", "ushl"]] = None,
158
+ ) -> Any:
159
+ """Games.
160
+
161
+ Use when querying past or future games with filters. Returns scores, teams, venue, and game
162
+ metadata. For upcoming-only games, prefer get_schedule (2 cr) instead. Costs 5 credits.
163
+
164
+ Costs 5 credits per call.
165
+
166
+ Args:
167
+ date_from (optional): Start date (YYYY-MM-DD)
168
+ date_to (optional): End date (YYYY-MM-DD)
169
+ team (optional): Team abbreviation to filter (home or away)
170
+ season (optional): Season ID, 8-digit (e.g. 20242025 for 2024-25). 2024-25 and 2024-2025
171
+ also accepted.
172
+ game_state (optional): Filter by game state. FINAL and OFF both mean finished and return the
173
+ same games; FUT is scheduled, LIVE in progress.
174
+ game_type (optional): Filter by game type. One of: regular, playoff, preseason.
175
+ limit (optional): Max results (default 100)
176
+ league (optional): League. Defaults to nhl. One of: nhl, pwhl, ohl, whl, qmjhl, echl, ahl,
177
+ ushl.
178
+
179
+ Returns:
180
+ The unwrapped ``data`` object from the response.
181
+ """
182
+ return self._call(
183
+ "get_games",
184
+ {
185
+ "date_from": date_from,
186
+ "date_to": date_to,
187
+ "team": team,
188
+ "season": season,
189
+ "game_state": game_state,
190
+ "game_type": game_type,
191
+ "limit": limit,
192
+ "league": league,
193
+ },
194
+ )
195
+
196
+ def get_schedule(
197
+ self,
198
+ *,
199
+ team: Optional[str] = None,
200
+ days: Optional[int] = None,
201
+ league: Optional[Literal["nhl", "pwhl", "ohl", "whl", "qmjhl", "echl", "ahl", "ushl"]] = None,
202
+ ) -> Any:
203
+ """Schedule.
204
+
205
+ Use when checking what games are coming up. Returns only unplayed future games for the next N
206
+ days (default 7). For past games, use get_games instead. Costs 2 credits.
207
+
208
+ Costs 2 credits per call.
209
+
210
+ Args:
211
+ team (optional): Team abbreviation to filter
212
+ days (optional): Number of days ahead to look (default 7)
213
+ league (optional): League. Defaults to nhl. One of: nhl, pwhl, ohl, whl, qmjhl, echl, ahl,
214
+ ushl.
215
+
216
+ Returns:
217
+ The unwrapped ``data`` object from the response.
218
+ """
219
+ return self._call(
220
+ "get_schedule",
221
+ {
222
+ "team": team,
223
+ "days": days,
224
+ "league": league,
225
+ },
226
+ )
227
+
228
+ def get_game_detail(
229
+ self,
230
+ game_id: str,
231
+ *,
232
+ league: Optional[Literal["nhl", "pwhl", "ohl", "whl", "qmjhl", "echl", "ahl", "ushl"]] = None,
233
+ ) -> Any:
234
+ """Game detail.
235
+
236
+ Use when you need everything about one game: both teams' full info, all betting odds, and the
237
+ goalies who started, with their time on ice. Requires a game ID (get one from get_games or
238
+ get_schedule). Odds for every game from 2019-20 on (and part of the 2019 playoffs). Goalie
239
+ starts are derived from play-by-play, so they are available for played games, not upcoming ones.
240
+ Costs 10 credits.
241
+
242
+ Costs 10 credits per call.
243
+
244
+ Args:
245
+ game_id: NHL game ID (e.g. 2025020887)
246
+ league (optional): League. Defaults to nhl. One of: nhl, pwhl, ohl, whl, qmjhl, echl, ahl,
247
+ ushl.
248
+
249
+ Returns:
250
+ The unwrapped ``data`` object from the response.
251
+ """
252
+ return self._call(
253
+ "get_game_detail",
254
+ {
255
+ "game_id": game_id,
256
+ "league": league,
257
+ },
258
+ )
259
+
260
+ def get_head_to_head(
261
+ self,
262
+ team1: str,
263
+ team2: str,
264
+ *,
265
+ season: Optional[str] = None,
266
+ limit: Optional[int] = None,
267
+ league: Optional[Literal["nhl", "pwhl", "ohl", "whl", "qmjhl", "echl", "ahl", "ushl"]] = None,
268
+ ) -> Any:
269
+ """Head to head.
270
+
271
+ Use when comparing two teams' history. Returns recent matchups with win/loss record. Can filter
272
+ by season or get all-time. Costs 10 credits.
273
+
274
+ Costs 10 credits per call.
275
+
276
+ Args:
277
+ team1: First team abbreviation (e.g. BUF)
278
+ team2: Second team abbreviation (e.g. TOR)
279
+ season (optional): Season ID, 8-digit (e.g. 20242025 for 2024-25). 2024-25 and 2024-2025
280
+ also accepted. Omit for all-time.
281
+ limit (optional): Max games to return (default 20)
282
+ league (optional): League. Defaults to nhl. One of: nhl, pwhl, ohl, whl, qmjhl, echl, ahl,
283
+ ushl.
284
+
285
+ Returns:
286
+ The unwrapped ``data`` object from the response.
287
+ """
288
+ return self._call(
289
+ "get_head_to_head",
290
+ {
291
+ "team1": team1,
292
+ "team2": team2,
293
+ "season": season,
294
+ "limit": limit,
295
+ "league": league,
296
+ },
297
+ )
298
+
299
+ def search_players(
300
+ self,
301
+ query: str,
302
+ *,
303
+ team: Optional[str] = None,
304
+ position: Optional[Literal["G", "D", "C", "LW", "RW"]] = None,
305
+ active: Optional[bool] = None,
306
+ limit: Optional[int] = None,
307
+ league: Optional[Literal["nhl", "pwhl", "ohl", "whl", "qmjhl", "echl", "ahl", "ushl"]] = None,
308
+ ) -> Any:
309
+ """Search players.
310
+
311
+ Use when looking up a player by name. Searches 4,900+ players across every season since 2010-11.
312
+ Returns active players by default; set active=false for retired/historical. Use the returned
313
+ player ID with get_player_stats for full details. Costs 2 credits.
314
+
315
+ Costs 2 credits per call.
316
+
317
+ Args:
318
+ query: Player name to search for (partial match supported)
319
+ team (optional): Filter by team abbreviation
320
+ position (optional): Filter by position. One of: G, D, C, LW, RW.
321
+ active (optional): Filter by active status (default: true). Set false to search active plus
322
+ retired/historical players.
323
+ limit (optional): Max results (default 10)
324
+ league (optional): League. Defaults to nhl. One of: nhl, pwhl, ohl, whl, qmjhl, echl, ahl,
325
+ ushl.
326
+
327
+ Returns:
328
+ The unwrapped ``data`` object from the response.
329
+ """
330
+ return self._call(
331
+ "search_players",
332
+ {
333
+ "query": query,
334
+ "team": team,
335
+ "position": position,
336
+ "active": active,
337
+ "limit": limit,
338
+ "league": league,
339
+ },
340
+ )
341
+
342
+ def get_player_stats(
343
+ self,
344
+ player_id: int,
345
+ *,
346
+ league: Optional[Literal["nhl", "pwhl", "ohl", "whl", "qmjhl", "echl", "ahl", "ushl"]] = None,
347
+ ) -> Any:
348
+ """Player stats.
349
+
350
+ Use when you need full details for one player: bio, team, physical attributes, and headshot. For
351
+ skaters, also returns the latest season line (games, goals, assists, points, +/-, PP/SH,
352
+ shooting%, TOI). For goalies, save%, GAA, GSAX, and trend data. Requires player ID from
353
+ search_players. Costs 5 credits.
354
+
355
+ Costs 5 credits per call.
356
+
357
+ Args:
358
+ player_id: NHL player ID
359
+ league (optional): League. Defaults to nhl. One of: nhl, pwhl, ohl, whl, qmjhl, echl, ahl,
360
+ ushl.
361
+
362
+ Returns:
363
+ The unwrapped ``data`` object from the response.
364
+ """
365
+ return self._call(
366
+ "get_player_stats",
367
+ {
368
+ "player_id": player_id,
369
+ "league": league,
370
+ },
371
+ )
372
+
373
+ def get_goalie_stats(
374
+ self,
375
+ *,
376
+ team: Optional[str] = None,
377
+ season: Optional[str] = None,
378
+ min_games: Optional[int] = None,
379
+ sort_by: Optional[Literal["save_pct", "gaa", "gsax", "wins"]] = None,
380
+ limit: Optional[int] = None,
381
+ league: Optional[Literal["nhl", "pwhl", "ohl", "whl", "qmjhl", "echl", "ahl", "ushl"]] = None,
382
+ ) -> Any:
383
+ """Goalie stats.
384
+
385
+ Use when ranking goalies or comparing goalie performance. Returns a leaderboard sorted by save%,
386
+ GAA, GSAX, or wins, with a games-played filter. Includes goals saved above expected, high-danger
387
+ save%, rolling save% and GSAX over the last 10 appearances, form trend and rest days. Goalie
388
+ expected goals cover every strength, unlike the 5v5-only team possession columns. Costs 5
389
+ credits.
390
+
391
+ Costs 5 credits per call.
392
+
393
+ Args:
394
+ team (optional): Filter by team abbreviation
395
+ season (optional): Season ID, 8-digit (e.g. 20242025 for 2024-25). 2024-25 and 2024-2025
396
+ also accepted. Defaults to the most recent season with stats, which is the current
397
+ season once it is under way and the previous one before that. The season actually used
398
+ is echoed in filters.season.
399
+ min_games (optional): Minimum games played (default 10)
400
+ sort_by (optional): Sort metric (default save_pct). gsax is goals saved above expected. One
401
+ of: save_pct, gaa, gsax, wins.
402
+ limit (optional): Max results (default 20)
403
+ league (optional): League. Defaults to nhl. One of: nhl, pwhl, ohl, whl, qmjhl, echl, ahl,
404
+ ushl.
405
+
406
+ Returns:
407
+ The unwrapped ``data`` object from the response.
408
+ """
409
+ return self._call(
410
+ "get_goalie_stats",
411
+ {
412
+ "team": team,
413
+ "season": season,
414
+ "min_games": min_games,
415
+ "sort_by": sort_by,
416
+ "limit": limit,
417
+ "league": league,
418
+ },
419
+ )
420
+
421
+ def get_skater_season_stats(
422
+ self,
423
+ *,
424
+ team: Optional[str] = None,
425
+ season: Optional[str] = None,
426
+ min_games: Optional[int] = None,
427
+ sort_by: Optional[Literal["points", "goals", "assists", "plus_minus", "shots"]] = None,
428
+ limit: Optional[int] = None,
429
+ league: Optional[Literal["nhl", "pwhl", "ohl", "whl", "qmjhl", "echl", "ahl", "ushl"]] = None,
430
+ ) -> Any:
431
+ """Skater season stats.
432
+
433
+ Use when ranking skaters or comparing scoring. Returns a leaderboard sorted by points, goals,
434
+ assists, plus/minus, or shots, with a games-played filter. Includes power play and shorthanded
435
+ production, shooting%, faceoff%, and average time on ice. Seasons from 2010-11 on. Costs 5
436
+ credits.
437
+
438
+ Costs 5 credits per call.
439
+
440
+ Args:
441
+ team (optional): Filter by team abbreviation
442
+ season (optional): Season ID, 8-digit (e.g. 20242025 for 2024-25). 2024-25 and 2024-2025
443
+ also accepted. Defaults to the most recent season with stats, which is the current
444
+ season once it is under way and the previous one before that. The season actually used
445
+ is echoed in filters.season.
446
+ min_games (optional): Minimum games played (default 10)
447
+ sort_by (optional): Sort metric (default points). One of: points, goals, assists,
448
+ plus_minus, shots.
449
+ limit (optional): Max results (default 20)
450
+ league (optional): League. Defaults to nhl. One of: nhl, pwhl, ohl, whl, qmjhl, echl, ahl,
451
+ ushl.
452
+
453
+ Returns:
454
+ The unwrapped ``data`` object from the response.
455
+ """
456
+ return self._call(
457
+ "get_skater_season_stats",
458
+ {
459
+ "team": team,
460
+ "season": season,
461
+ "min_games": min_games,
462
+ "sort_by": sort_by,
463
+ "limit": limit,
464
+ "league": league,
465
+ },
466
+ )
467
+
468
+ def get_player_game_log(
469
+ self,
470
+ player_id: int,
471
+ *,
472
+ season: Optional[str] = None,
473
+ game_type: Optional[Literal["regular", "playoff", "preseason", "all"]] = None,
474
+ limit: Optional[int] = None,
475
+ offset: Optional[int] = None,
476
+ league: Optional[Literal["nhl", "pwhl", "ohl", "whl", "qmjhl", "echl", "ahl", "ushl"]] = None,
477
+ ) -> Any:
478
+ """Player game log.
479
+
480
+ Use when you need a player's game-by-game stat lines for a season, not a season total. For
481
+ skaters: date, opponent, home/away, goals, assists, points, shots, PIM and power-play points for
482
+ each game. For goalies: date, opponent, home/away, decision, shots against, saves, goals against
483
+ and save% for each game. Built from play-by-play, so time on ice and plus/minus are not
484
+ available and come back null; goalie time on ice is available only for games the goalie started.
485
+ Requires player ID from search_players. Costs 5 credits.
486
+
487
+ Costs 5 credits per call.
488
+
489
+ Args:
490
+ player_id: NHL player ID
491
+ season (optional): Season ID, 8-digit (e.g. 20242025 for 2024-25). 2024-25 and 2024-2025
492
+ also accepted. Defaults to the most recent season with stats for this player, which is
493
+ the current season once it is under way and the previous one before that. The season
494
+ actually used is echoed back in the response.
495
+ game_type (optional): Which games to include: regular, playoff, preseason, or all. Defaults
496
+ to regular, matching every other stats tool.
497
+ limit (optional): Max games to return (default 100)
498
+ offset (optional): Pagination offset
499
+ league (optional): League. Defaults to nhl. One of: nhl, pwhl, ohl, whl, qmjhl, echl, ahl,
500
+ ushl.
501
+
502
+ Returns:
503
+ The unwrapped ``data`` object from the response.
504
+ """
505
+ return self._call(
506
+ "get_player_game_log",
507
+ {
508
+ "player_id": player_id,
509
+ "season": season,
510
+ "game_type": game_type,
511
+ "limit": limit,
512
+ "offset": offset,
513
+ "league": league,
514
+ },
515
+ )
516
+
517
+ def get_odds(
518
+ self,
519
+ *,
520
+ game_id: Optional[str] = None,
521
+ season: Optional[str] = None,
522
+ team: Optional[str] = None,
523
+ bookmaker: Optional[str] = None,
524
+ snapshot_type: Optional[Literal["opening", "closing"]] = None,
525
+ all_books: Optional[bool] = None,
526
+ limit: Optional[int] = None,
527
+ offset: Optional[int] = None,
528
+ estimate_only: Optional[bool] = None,
529
+ ) -> Any:
530
+ """Odds.
531
+
532
+ Use when checking betting lines. Pass game_id for one game (10 credits): moneyline, puck line
533
+ and total by bookmaker, opening and closing. Or pass season (optionally with team) for a whole
534
+ season of closing lines in one call, with final scores, at 10 credits per game returned (a full
535
+ season is ~13,700 credits, a team-season ~820), 100 games a page by default (up to 500). Each
536
+ book's line is an array in the order given by columns. Set estimate_only to get the price
537
+ without being charged. Every game from 2019-20 on (and part of the 2019 playoffs): about 16 to
538
+ 18 books a game from 2020-21 to 2023-24, about 6 in 2019-20, 8 in 2024-25 and 2025-26 (60+ on
539
+ about 300 games in 2025-26), with all_books; a season answer defaults to the four main books. A
540
+ season those four do not carry (2019-20) returns every book it has. Each line says its source:
541
+ the_odds_api (our Odds API pulls, from August 2020) or espn (ESPN's per-book lines); a season
542
+ answer lists each game's sources.
543
+
544
+ Costs 10 credits per call.
545
+
546
+ Args:
547
+ game_id (optional): NHL game ID (e.g. 2025020887). Omit and pass season for a whole season.
548
+ season (optional): Season for a whole season of lines, e.g. 2025-26 or 20252026. Used when
549
+ game_id is not set.
550
+ team (optional): With season: only this team's games (abbreviation, e.g. BUF).
551
+ bookmaker (optional): Filter by bookmaker key (e.g. draftkings, fanduel, betmgm). Lowercase.
552
+ snapshot_type (optional): opening (game-day morning; for a game not yet played, the latest
553
+ morning line) or closing (final pre-game). Single game: default both. Season: default
554
+ closing.
555
+ all_books (optional): With season: every book held (16 to 18 a game from 2020-21 to 2023-24,
556
+ 8 in 2024-25, more than 60 on about 300 games in 2025-26) instead of DraftKings,
557
+ FanDuel, BetMGM and ESPN BET.
558
+ limit (optional): With season: games per page (default 100, max 500).
559
+ offset (optional): With season: page offset; use next_offset from the previous page.
560
+ estimate_only (optional): Return what this call would cost, without charging or running it.
561
+
562
+ Returns:
563
+ The unwrapped ``data`` object from the response.
564
+ """
565
+ return self._call(
566
+ "get_odds",
567
+ {
568
+ "game_id": game_id,
569
+ "season": season,
570
+ "team": team,
571
+ "bookmaker": bookmaker,
572
+ "snapshot_type": snapshot_type,
573
+ "all_books": all_books,
574
+ "limit": limit,
575
+ "offset": offset,
576
+ "estimate_only": estimate_only,
577
+ },
578
+ )
579
+
580
+ def get_line_movement(
581
+ self,
582
+ game_id: str,
583
+ *,
584
+ bookmaker: Optional[str] = None,
585
+ ) -> Any:
586
+ """Line movement.
587
+
588
+ Use when analyzing how betting lines moved over time. Returns time-series snapshots grouped by
589
+ bookmaker. Most expensive tool (25 cr). If you only need current lines, use get_odds (10 cr)
590
+ instead.
591
+
592
+ Costs 25 credits per call.
593
+
594
+ Args:
595
+ game_id: NHL game ID
596
+ bookmaker (optional): Filter by specific bookmaker key (lowercase)
597
+
598
+ Returns:
599
+ The unwrapped ``data`` object from the response.
600
+ """
601
+ return self._call(
602
+ "get_line_movement",
603
+ {
604
+ "game_id": game_id,
605
+ "bookmaker": bookmaker,
606
+ },
607
+ )
608
+
609
+ def get_player_props(
610
+ self,
611
+ *,
612
+ game_id: Optional[str] = None,
613
+ player_id: Optional[Union[int, float, str]] = None,
614
+ from_date: Optional[str] = None,
615
+ to_date: Optional[str] = None,
616
+ market: Optional[Literal["player_points", "player_goals", "player_assists", "player_shots_on_goal", "player_blocked_shots", "player_total_saves", "player_goal_scorer_anytime"]] = None,
617
+ bookmaker: Optional[str] = None,
618
+ snapshot_type: Optional[Literal["opening", "closing"]] = None,
619
+ estimate_only: Optional[bool] = None,
620
+ ) -> Any:
621
+ """Player props.
622
+
623
+ Use for player prop lines by sportsbook: over/under on points, goals, assists, shots on goal,
624
+ blocked shots, goalie saves and anytime goal scorer, from May 2023 (DraftKings, FanDuel, BetMGM,
625
+ ESPN BET, Pinnacle and others). Pass game_id for every player's props in one game (10 credits),
626
+ or player_id with from_date (and to_date) for one player across games (10 credits per game
627
+ returned, up to 100). Returns the closing line by default (the last before the game starts) or
628
+ the opening line, with each book's over and under prices. Set estimate_only to get the price
629
+ without being charged.
630
+
631
+ Costs 10 credits per call.
632
+
633
+ Args:
634
+ game_id (optional): Game id: every player's props for that game.
635
+ player_id (optional): Player id (e.g. 8478402) from search_players. With from_date: that
636
+ player's props across games.
637
+ from_date (optional): With player_id: first date, YYYY-MM-DD (the game's date).
638
+ to_date (optional): With player_id: last date (default: no end), YYYY-MM-DD (the game's
639
+ date).
640
+ market (optional): One market: player_points (points), player_goals (goals), player_assists
641
+ (assists), player_shots_on_goal (shots on goal), player_blocked_shots (blocked shots),
642
+ player_total_saves (goalie saves), player_goal_scorer_anytime (anytime goal scorer (over
643
+ = scores))
644
+ bookmaker (optional): Bookmaker key, e.g. draftkings, fanduel, pinnacle.
645
+ snapshot_type (optional): closing (default): the last line before the game starts. opening:
646
+ the first one captured.
647
+ estimate_only (optional): Return what this call would cost, without charging or running it.
648
+
649
+ Returns:
650
+ The unwrapped ``data`` object from the response.
651
+ """
652
+ return self._call(
653
+ "get_player_props",
654
+ {
655
+ "game_id": game_id,
656
+ "player_id": player_id,
657
+ "from_date": from_date,
658
+ "to_date": to_date,
659
+ "market": market,
660
+ "bookmaker": bookmaker,
661
+ "snapshot_type": snapshot_type,
662
+ "estimate_only": estimate_only,
663
+ },
664
+ )
665
+
666
+ def get_prop_history(
667
+ self,
668
+ player_id: Union[int, float, str],
669
+ market: Literal["player_points", "player_goals", "player_assists", "player_shots_on_goal", "player_blocked_shots", "player_total_saves", "player_goal_scorer_anytime"],
670
+ *,
671
+ from_date: Optional[str] = None,
672
+ to_date: Optional[str] = None,
673
+ bookmaker: Optional[str] = None,
674
+ limit: Optional[int] = None,
675
+ ) -> Any:
676
+ """Prop history.
677
+
678
+ Use to see how a player did against his prop line over time: for one market (points, goals,
679
+ assists, shots on goal, blocked shots, goalie saves or anytime goal scorer), one row per game
680
+ with the closing line (the median across books, or one book's), the opening line, the prices,
681
+ what the player actually recorded from our box scores and the result against the line, plus the
682
+ over rate. Costs 10 credits for up to 200 games.
683
+
684
+ Costs 10 credits per call.
685
+
686
+ Args:
687
+ player_id: Player id (e.g. 8478402) from search_players.
688
+ market: The market: player_points (points), player_goals (goals), player_assists (assists),
689
+ player_shots_on_goal (shots on goal), player_blocked_shots (blocked shots),
690
+ player_total_saves (goalie saves), player_goal_scorer_anytime (anytime goal scorer (over
691
+ = scores))
692
+ from_date (optional): First date, YYYY-MM-DD (the game's date).
693
+ to_date (optional): Last date, YYYY-MM-DD (the game's date).
694
+ bookmaker (optional): One book's closing line instead of the median across books, e.g.
695
+ draftkings.
696
+ limit (optional): Games to return, oldest first (default 50, max 200). next_from_date says
697
+ where to continue.
698
+
699
+ Returns:
700
+ The unwrapped ``data`` object from the response.
701
+ """
702
+ return self._call(
703
+ "get_prop_history",
704
+ {
705
+ "player_id": player_id,
706
+ "market": market,
707
+ "from_date": from_date,
708
+ "to_date": to_date,
709
+ "bookmaker": bookmaker,
710
+ "limit": limit,
711
+ },
712
+ )
713
+
714
+ def get_plays(
715
+ self,
716
+ *,
717
+ game_id: Optional[str] = None,
718
+ season: Optional[str] = None,
719
+ team: Optional[str] = None,
720
+ player_id: Optional[int] = None,
721
+ type: Optional[Literal["goal", "shot-on-goal", "missed-shot", "blocked-shot", "faceoff", "hit", "giveaway", "takeaway", "penalty", "delayed-penalty", "stoppage", "period-start", "period-end", "game-end", "shootout-complete", "failed-shot-attempt"]] = None,
722
+ strength: Optional[str] = None,
723
+ zone: Optional[Literal["O", "N", "D"]] = None,
724
+ period: Optional[int] = None,
725
+ shot_attempts_only: Optional[bool] = None,
726
+ limit: Optional[int] = None,
727
+ offset: Optional[int] = None,
728
+ league: Optional[Literal["nhl", "pwhl", "ohl", "whl", "qmjhl", "echl", "ahl", "ushl"]] = None,
729
+ ) -> Any:
730
+ """Plays.
731
+
732
+ Use for play-by-play events: goals, shots, misses, blocks, faceoffs, hits, giveaways, takeaways,
733
+ penalties, with rink coordinates, strength state (5v5, 5v4), zone, and the players involved.
734
+ Filter by game, season, team, player (any role), event type, strength, zone, or period. Requires
735
+ at least one of game_id, season or player_id. Paginate with offset. Costs 10 credits.
736
+
737
+ Costs 10 credits per call.
738
+
739
+ Args:
740
+ game_id (optional): NHL game ID (e.g. 2025020887)
741
+ season (optional): Season ID, 8-digit (e.g. 20242025).
742
+ team (optional): Team abbreviation that owns the event (e.g. BUF)
743
+ player_id (optional): NHL player ID; matches the player in any role on the event
744
+ type (optional): Event type. One of: goal, shot-on-goal, missed-shot, blocked-shot, faceoff,
745
+ hit, giveaway, takeaway, penalty, delayed-penalty, stoppage, period-start, period-end,
746
+ game-end, shootout-complete, failed-shot-attempt.
747
+ strength (optional): Skater strength from the event owner's view, e.g. 5v5, 5v4, 4v5
748
+ zone (optional): Zone: O offensive, N neutral, D defensive
749
+ period (optional): Period number (4+ is overtime)
750
+ shot_attempts_only (optional): Only goals, shots on goal, missed shots and blocked shots
751
+ (Corsi events)
752
+ limit (optional): Max events (default 200)
753
+ offset (optional): Pagination offset
754
+ league (optional): League. Defaults to nhl. One of: nhl, pwhl, ohl, whl, qmjhl, echl, ahl,
755
+ ushl.
756
+
757
+ Returns:
758
+ The unwrapped ``data`` object from the response.
759
+ """
760
+ return self._call(
761
+ "get_plays",
762
+ {
763
+ "game_id": game_id,
764
+ "season": season,
765
+ "team": team,
766
+ "player_id": player_id,
767
+ "type": type,
768
+ "strength": strength,
769
+ "zone": zone,
770
+ "period": period,
771
+ "shot_attempts_only": shot_attempts_only,
772
+ "limit": limit,
773
+ "offset": offset,
774
+ "league": league,
775
+ },
776
+ )
777
+
778
+ def get_shot_map(
779
+ self,
780
+ *,
781
+ game_id: Optional[str] = None,
782
+ season: Optional[str] = None,
783
+ team: Optional[str] = None,
784
+ player_id: Optional[int] = None,
785
+ strength: Optional[str] = None,
786
+ limit: Optional[int] = None,
787
+ offset: Optional[int] = None,
788
+ league: Optional[Literal["nhl", "pwhl", "ohl", "qmjhl", "echl", "ahl"]] = None,
789
+ ) -> Any:
790
+ """Shot map.
791
+
792
+ Use when you want shot locations rather than a list of events: every shot attempt with rink
793
+ coordinates, shot type, strength, shooter and goalie. Filter by game, or by season plus a team
794
+ or player. Paginated: follow next_offset, since a season runs past one page and pages are
795
+ chronological. Costs 10 credits.
796
+
797
+ Costs 10 credits per call.
798
+
799
+ Args:
800
+ game_id (optional): NHL game ID
801
+ season (optional): Season ID, 8-digit (e.g. 20242025); use with team
802
+ team (optional): Team abbreviation; use with season
803
+ player_id (optional): NHL player ID of the shooter
804
+ strength (optional): Strength filter, e.g. 5v5
805
+ limit (optional): Max shots per page (default 1000)
806
+ offset (optional): Pagination offset; follow next_offset for a full season
807
+ league (optional): League. Defaults to nhl. One of: nhl, pwhl, ohl, qmjhl, echl, ahl.
808
+
809
+ Returns:
810
+ The unwrapped ``data`` object from the response.
811
+ """
812
+ return self._call(
813
+ "get_shot_map",
814
+ {
815
+ "game_id": game_id,
816
+ "season": season,
817
+ "team": team,
818
+ "player_id": player_id,
819
+ "strength": strength,
820
+ "limit": limit,
821
+ "offset": offset,
822
+ "league": league,
823
+ },
824
+ )
825
+
826
+ def get_shifts(
827
+ self,
828
+ game_id: str,
829
+ *,
830
+ team: Optional[str] = None,
831
+ player_id: Optional[int] = None,
832
+ ) -> Any:
833
+ """Shifts.
834
+
835
+ Use for who was on the ice and when: every player's shifts in one NHL game, each with period,
836
+ start and end (period clock and seconds from the opening faceoff) and duration, plus the
837
+ official boxscore time on ice and plus/minus. Filter to one team or player. NHL games from
838
+ 2010-11 on. Costs 10 credits.
839
+
840
+ Costs 10 credits per call.
841
+
842
+ Args:
843
+ game_id: NHL game ID, 10 digits (e.g. 2026020084)
844
+ team (optional): Only this team's players, by abbreviation (e.g. WSH)
845
+ player_id (optional): Only this player, by NHL player ID
846
+
847
+ Returns:
848
+ The unwrapped ``data`` object from the response.
849
+ """
850
+ return self._call(
851
+ "get_shifts",
852
+ {
853
+ "game_id": game_id,
854
+ "team": team,
855
+ "player_id": player_id,
856
+ },
857
+ )
858
+
859
+ def get_situation_time(
860
+ self,
861
+ *,
862
+ game_id: Optional[str] = None,
863
+ date: Optional[str] = None,
864
+ include_players: Optional[bool] = None,
865
+ ) -> Any:
866
+ """Situation time.
867
+
868
+ Use for exact time at each strength: the seconds each team spent at 5v5, 5v4, 4v5, 4v4, 6v5 with
869
+ the goalie pulled and every other on-ice state in an NHL game, split into regulation and
870
+ overtime, from the shift charts. Also even / power-play / shorthanded totals, goalie-pulled
871
+ seconds, period lengths and a completeness check against the play-by-play. include_players adds
872
+ each skater's time by strength. One game by game_id (10 credits), or every game on a date (10
873
+ credits per game). NHL games from 2010-11 on.
874
+
875
+ Costs 10 credits per call.
876
+
877
+ Args:
878
+ game_id (optional): NHL game ID, 10 digits (e.g. 2026020084)
879
+ date (optional): Every game played on this date, YYYY-MM-DD (instead of game_id)
880
+ include_players (optional): Add each skater's seconds by strength (default false)
881
+
882
+ Returns:
883
+ The unwrapped ``data`` object from the response.
884
+ """
885
+ return self._call(
886
+ "get_situation_time",
887
+ {
888
+ "game_id": game_id,
889
+ "date": date,
890
+ "include_players": include_players,
891
+ },
892
+ )