endzoneapi 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.
endzoneapi/client.py ADDED
@@ -0,0 +1,880 @@
1
+ """Generated by packages/python/generate.py from the EndzoneAPI 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
+ "list_teams": 1,
11
+ "get_standings": 2,
12
+ "get_team_stats": 5,
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_player_leaders": 5,
20
+ "get_injuries": 2,
21
+ "get_depth_chart": 2,
22
+ "get_snap_counts": 5,
23
+ "get_plays": 10,
24
+ "get_advanced_stats": 5,
25
+ "get_odds": 10,
26
+ "get_line_movement": 25,
27
+ "get_player_props": 10,
28
+ "get_prop_history": 10,
29
+ "get_alt_lines": 10,
30
+ }
31
+
32
+
33
+ class Client(BaseClient):
34
+ """Client for the EndzoneAPI API (NFL).
35
+
36
+ Create one with ``Client()`` (reads ENDZONEAPI_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 list_teams(
43
+ self,
44
+ *,
45
+ conference: Optional[Literal["AFC", "NFC"]] = None,
46
+ division: Optional[str] = None,
47
+ ) -> Any:
48
+ """List teams.
49
+
50
+ Use when you need team codes, or all 32 current teams with conference, division, colours, and
51
+ logo URLs. Team codes are nflverse spelling (LA for the Rams, WAS for Washington). Cheapest tool
52
+ at 1 credit.
53
+
54
+ Costs 1 credit per call.
55
+
56
+ Args:
57
+ conference (optional): Filter by conference. One of: AFC, NFC.
58
+ division (optional): Filter by division, e.g. 'AFC East' or 'NFC West'
59
+
60
+ Returns:
61
+ The unwrapped ``data`` object from the response.
62
+ """
63
+ return self._call(
64
+ "list_teams",
65
+ {
66
+ "conference": conference,
67
+ "division": division,
68
+ },
69
+ )
70
+
71
+ def get_standings(
72
+ self,
73
+ *,
74
+ season: Optional[Union[str, int, float]] = None,
75
+ conference: Optional[Literal["AFC", "NFC"]] = None,
76
+ division: Optional[str] = None,
77
+ ) -> Any:
78
+ """Standings.
79
+
80
+ Use for regular-season standings and playoff seeding: record, win%, points for/against,
81
+ home/away/division/conference records, streak, division rank, and conference seed. Ranks apply
82
+ the real NFL tiebreaking procedure and report which step decided each one. Computed from final
83
+ scores. Defaults to the current season. Costs 2 credits.
84
+
85
+ Costs 2 credits per call.
86
+
87
+ Args:
88
+ season (optional): Season year the regular season starts (e.g. 2025). Defaults to current.
89
+ conference (optional): Filter by conference. One of: AFC, NFC.
90
+ division (optional): Filter by division, e.g. 'NFC North'
91
+
92
+ Returns:
93
+ The unwrapped ``data`` object from the response.
94
+ """
95
+ return self._call(
96
+ "get_standings",
97
+ {
98
+ "season": season,
99
+ "conference": conference,
100
+ "division": division,
101
+ },
102
+ )
103
+
104
+ def get_team_stats(
105
+ self,
106
+ team: str,
107
+ *,
108
+ season: Optional[Union[str, int, float]] = None,
109
+ season_type: Optional[Literal["REG", "POST"]] = None,
110
+ ) -> Any:
111
+ """Team stats.
112
+
113
+ Use for one team's season: totals (passing, rushing, receiving, defense, kicking, penalties),
114
+ EPA per play, yards per attempt/carry, the standings row, and every weekly stat line. Costs 5
115
+ credits.
116
+
117
+ Costs 5 credits per call.
118
+
119
+ Args:
120
+ team: Team code (e.g. KC, BUF, PHI)
121
+ season (optional): Season year (e.g. 2025). Defaults to current.
122
+ season_type (optional): Regular season (default) or postseason. One of: REG, POST.
123
+
124
+ Returns:
125
+ The unwrapped ``data`` object from the response.
126
+ """
127
+ return self._call(
128
+ "get_team_stats",
129
+ {
130
+ "team": team,
131
+ "season": season,
132
+ "season_type": season_type,
133
+ },
134
+ )
135
+
136
+ def get_games(
137
+ self,
138
+ *,
139
+ season: Optional[Union[str, int, float]] = None,
140
+ week: Optional[int] = None,
141
+ team: Optional[str] = None,
142
+ date_from: Optional[str] = None,
143
+ date_to: Optional[str] = None,
144
+ game_type: Optional[Literal["REG", "WC", "DIV", "CON", "SB", "POST"]] = None,
145
+ status: Optional[Literal["FUT", "LIVE", "FINAL"]] = None,
146
+ limit: Optional[int] = None,
147
+ ) -> Any:
148
+ """Games.
149
+
150
+ Use when querying past or future games with filters: season, week, team, date range, game type,
151
+ status. Returns scores, kickoff (UTC), venue, rest days, starting QBs, coaches, referee, and the
152
+ consensus closing spread, total, and moneylines. For upcoming-only games prefer get_schedule (2
153
+ cr). Costs 5 credits.
154
+
155
+ Costs 5 credits per call.
156
+
157
+ Args:
158
+ season (optional): Season year (e.g. 2025)
159
+ week (optional): Week number (1-18 regular season; 19+ postseason)
160
+ team (optional): Team code (home or away)
161
+ date_from (optional): Start date YYYY-MM-DD
162
+ date_to (optional): End date YYYY-MM-DD
163
+ game_type (optional): REG, WC, DIV, CON, SB, or POST for any playoff game
164
+ status (optional): Game status. One of: FUT, LIVE, FINAL.
165
+ limit (optional): Max results (default 100)
166
+
167
+ Returns:
168
+ The unwrapped ``data`` object from the response.
169
+ """
170
+ return self._call(
171
+ "get_games",
172
+ {
173
+ "season": season,
174
+ "week": week,
175
+ "team": team,
176
+ "date_from": date_from,
177
+ "date_to": date_to,
178
+ "game_type": game_type,
179
+ "status": status,
180
+ "limit": limit,
181
+ },
182
+ )
183
+
184
+ def get_schedule(
185
+ self,
186
+ *,
187
+ team: Optional[str] = None,
188
+ week: Optional[int] = None,
189
+ days: Optional[int] = None,
190
+ ) -> Any:
191
+ """Schedule.
192
+
193
+ Use to see what is coming up: unplayed games in the next N days (default 7), or a specific week
194
+ of the current season. Includes consensus lines where posted. Costs 2 credits.
195
+
196
+ Costs 2 credits per call.
197
+
198
+ Args:
199
+ team (optional): Team code to filter
200
+ week (optional): A specific week of the current season (returns all games that week, played
201
+ or not)
202
+ days (optional): Days ahead to look when week is not set (default 7)
203
+
204
+ Returns:
205
+ The unwrapped ``data`` object from the response.
206
+ """
207
+ return self._call(
208
+ "get_schedule",
209
+ {
210
+ "team": team,
211
+ "week": week,
212
+ "days": days,
213
+ },
214
+ )
215
+
216
+ def get_game_detail(
217
+ self,
218
+ game_id: str,
219
+ ) -> Any:
220
+ """Game detail.
221
+
222
+ Use when you need everything about one game: both teams, full team box-score stats (EPA,
223
+ success, drives), consensus closing line, per-bookmaker opening/closing/latest odds, weather,
224
+ surface, and officials. Requires a game id from get_games or get_schedule. Costs 10 credits.
225
+
226
+ Costs 10 credits per call.
227
+
228
+ Args:
229
+ game_id: Game id, e.g. 2025_01_KC_BUF
230
+
231
+ Returns:
232
+ The unwrapped ``data`` object from the response.
233
+ """
234
+ return self._call(
235
+ "get_game_detail",
236
+ {
237
+ "game_id": game_id,
238
+ },
239
+ )
240
+
241
+ def get_head_to_head(
242
+ self,
243
+ team1: str,
244
+ team2: str,
245
+ *,
246
+ season: Optional[Union[str, int, float]] = None,
247
+ limit: Optional[int] = None,
248
+ ) -> Any:
249
+ """Head to head.
250
+
251
+ Use to compare two teams' history: recent meetings with scores, the win/loss record between
252
+ them, and average margin. Filter by season or get all-time. Costs 10 credits.
253
+
254
+ Costs 10 credits per call.
255
+
256
+ Args:
257
+ team1: First team code
258
+ team2: Second team code
259
+ season (optional): Season year. Omit for all-time.
260
+ limit (optional): Max games (default 20)
261
+
262
+ Returns:
263
+ The unwrapped ``data`` object from the response.
264
+ """
265
+ return self._call(
266
+ "get_head_to_head",
267
+ {
268
+ "team1": team1,
269
+ "team2": team2,
270
+ "season": season,
271
+ "limit": limit,
272
+ },
273
+ )
274
+
275
+ def search_players(
276
+ self,
277
+ query: str,
278
+ *,
279
+ team: Optional[str] = None,
280
+ position: Optional[str] = None,
281
+ active: Optional[bool] = None,
282
+ limit: Optional[int] = None,
283
+ ) -> Any:
284
+ """Search players.
285
+
286
+ Use to find a player by name (partial match). Searches ~25,000 players back to 1999; returns
287
+ current-season players by default, falling back to all players back to 1999 when none match.
288
+ Returns the GSIS player id needed by get_player_stats. Costs 2 credits.
289
+
290
+ Costs 2 credits per call.
291
+
292
+ Args:
293
+ query: Player name or part of it
294
+ team (optional): Filter by current team code
295
+ position (optional): Filter by position (e.g. QB, RB, WR, TE, OL, DL, LB, DB)
296
+ active (optional): Default true, but an active-only search that finds nobody automatically
297
+ falls back to all players and says so. Set false to search everyone outright.
298
+ limit (optional): Max results (default 10)
299
+
300
+ Returns:
301
+ The unwrapped ``data`` object from the response.
302
+ """
303
+ return self._call(
304
+ "search_players",
305
+ {
306
+ "query": query,
307
+ "team": team,
308
+ "position": position,
309
+ "active": active,
310
+ "limit": limit,
311
+ },
312
+ )
313
+
314
+ def get_player_stats(
315
+ self,
316
+ player_id: str,
317
+ *,
318
+ season: Optional[Union[str, int, float]] = None,
319
+ season_type: Optional[Literal["REG", "POST"]] = None,
320
+ ) -> Any:
321
+ """Player stats.
322
+
323
+ Use for one player: bio, draft, physicals, headshot, id crosswalk (PFR, ESPN), summed season
324
+ totals across passing, rushing, receiving, defense, kicking, returns, and fantasy points, every
325
+ weekly stat line for the season, and games played per season. Defaults to the player's latest
326
+ season. Costs 5 credits.
327
+
328
+ Costs 5 credits per call.
329
+
330
+ Args:
331
+ player_id: GSIS player id from search_players (e.g. 00-0033873)
332
+ season (optional): Season year. Defaults to the player's latest season.
333
+ season_type (optional): Regular season (default) or postseason. One of: REG, POST.
334
+
335
+ Returns:
336
+ The unwrapped ``data`` object from the response.
337
+ """
338
+ return self._call(
339
+ "get_player_stats",
340
+ {
341
+ "player_id": player_id,
342
+ "season": season,
343
+ "season_type": season_type,
344
+ },
345
+ )
346
+
347
+ def get_player_leaders(
348
+ self,
349
+ stat: str,
350
+ *,
351
+ season: Optional[Union[str, int, float]] = None,
352
+ season_type: Optional[Literal["REG", "POST"]] = None,
353
+ position: Optional[str] = None,
354
+ team: Optional[str] = None,
355
+ min_games: Optional[int] = None,
356
+ limit: Optional[int] = None,
357
+ ) -> Any:
358
+ """Player leaders.
359
+
360
+ Use to rank players on any weekly stat over a season: passing_yards, passing_tds, rushing_yards,
361
+ receiving_yards, receptions, targets, def_sacks, def_interceptions, fantasy_points_ppr,
362
+ passing_epa, rushing_epa, receiving_epa, and ~130 more. Counting stats are summed, rate stats
363
+ averaged. Filter by position, team, minimum games. Costs 5 credits.
364
+
365
+ Costs 5 credits per call.
366
+
367
+ Args:
368
+ stat: Weekly stat column to rank by (e.g. passing_yards, receiving_epa, def_sacks)
369
+ season (optional): Season year. Defaults to current.
370
+ season_type (optional): Regular season (default) or postseason. One of: REG, POST.
371
+ position (optional): Position filter, e.g. QB, RB, WR, TE
372
+ team (optional): Team code filter
373
+ min_games (optional): Minimum games with a stat line (default 1)
374
+ limit (optional): Max results (default 20)
375
+
376
+ Returns:
377
+ The unwrapped ``data`` object from the response.
378
+ """
379
+ return self._call(
380
+ "get_player_leaders",
381
+ {
382
+ "stat": stat,
383
+ "season": season,
384
+ "season_type": season_type,
385
+ "position": position,
386
+ "team": team,
387
+ "min_games": min_games,
388
+ "limit": limit,
389
+ },
390
+ )
391
+
392
+ def get_injuries(
393
+ self,
394
+ *,
395
+ team: Optional[str] = None,
396
+ season: Optional[Union[str, int, float]] = None,
397
+ week: Optional[int] = None,
398
+ status: Optional[str] = None,
399
+ ) -> Any:
400
+ """Injuries.
401
+
402
+ Use for the official injury report: game status (Out, Doubtful, Questionable) and practice
403
+ participation with the injury named, by team and week. Defaults to the latest reported week of
404
+ the current season. Costs 2 credits.
405
+
406
+ Costs 2 credits per call.
407
+
408
+ Args:
409
+ team (optional): Team code
410
+ season (optional): Season year. Defaults to current.
411
+ week (optional): Week. Defaults to the latest week with a report.
412
+ status (optional): Filter by game status: Out, Doubtful, Questionable
413
+
414
+ Returns:
415
+ The unwrapped ``data`` object from the response.
416
+ """
417
+ return self._call(
418
+ "get_injuries",
419
+ {
420
+ "team": team,
421
+ "season": season,
422
+ "week": week,
423
+ "status": status,
424
+ },
425
+ )
426
+
427
+ def get_depth_chart(
428
+ self,
429
+ team: str,
430
+ *,
431
+ season: Optional[Union[str, int, float]] = None,
432
+ week: Optional[int] = None,
433
+ formation: Optional[str] = None,
434
+ ) -> Any:
435
+ """Depth chart.
436
+
437
+ Use for a team's depth chart by week: formation, position, depth rank, player. Defaults to the
438
+ latest week available. Costs 2 credits.
439
+
440
+ Costs 2 credits per call.
441
+
442
+ Args:
443
+ team: Team code
444
+ season (optional): Season year. Defaults to current.
445
+ week (optional): Week. Defaults to latest.
446
+ formation (optional): Filter by formation/unit, e.g. Offense, Defense, Special Teams
447
+
448
+ Returns:
449
+ The unwrapped ``data`` object from the response.
450
+ """
451
+ return self._call(
452
+ "get_depth_chart",
453
+ {
454
+ "team": team,
455
+ "season": season,
456
+ "week": week,
457
+ "formation": formation,
458
+ },
459
+ )
460
+
461
+ def get_snap_counts(
462
+ self,
463
+ *,
464
+ game_id: Optional[str] = None,
465
+ player_id: Optional[str] = None,
466
+ team: Optional[str] = None,
467
+ season: Optional[Union[str, int, float]] = None,
468
+ week: Optional[int] = None,
469
+ limit: Optional[int] = None,
470
+ ) -> Any:
471
+ """Snap counts.
472
+
473
+ Use for playing time: offensive, defensive, and special-teams snaps and snap shares, for one
474
+ game, one player (PFR id), or a team's season. Costs 5 credits.
475
+
476
+ Costs 5 credits per call.
477
+
478
+ Args:
479
+ game_id (optional): Game id, e.g. 2025_01_KC_BUF
480
+ player_id (optional): PFR player id (from search_players pfr_id)
481
+ team (optional): Team code
482
+ season (optional): Season year (with team or player)
483
+ week (optional): Week filter
484
+ limit (optional): Max rows (default 200)
485
+
486
+ Returns:
487
+ The unwrapped ``data`` object from the response.
488
+ """
489
+ return self._call(
490
+ "get_snap_counts",
491
+ {
492
+ "game_id": game_id,
493
+ "player_id": player_id,
494
+ "team": team,
495
+ "season": season,
496
+ "week": week,
497
+ "limit": limit,
498
+ },
499
+ )
500
+
501
+ def get_plays(
502
+ self,
503
+ *,
504
+ game_id: Optional[str] = None,
505
+ season: Optional[Union[str, int, float]] = None,
506
+ week: Optional[int] = None,
507
+ posteam: Optional[str] = None,
508
+ defteam: Optional[str] = None,
509
+ play_type: Optional[Literal["pass", "run", "punt", "kickoff", "field_goal", "extra_point", "qb_kneel", "qb_spike", "no_play"]] = None,
510
+ down: Optional[int] = None,
511
+ quarter: Optional[int] = None,
512
+ passer_id: Optional[str] = None,
513
+ rusher_id: Optional[str] = None,
514
+ receiver_id: Optional[str] = None,
515
+ min_wp: Optional[float] = None,
516
+ max_wp: Optional[float] = None,
517
+ red_zone: Optional[bool] = None,
518
+ third_down: Optional[bool] = None,
519
+ include_charting: Optional[bool] = None,
520
+ is_play_action: Optional[bool] = None,
521
+ is_motion: Optional[bool] = None,
522
+ is_rpo: Optional[bool] = None,
523
+ is_screen_pass: Optional[bool] = None,
524
+ is_no_huddle: Optional[bool] = None,
525
+ is_trick_play: Optional[bool] = None,
526
+ is_qb_out_of_pocket: Optional[bool] = None,
527
+ is_drop: Optional[bool] = None,
528
+ min_blitzers: Optional[int] = None,
529
+ limit: Optional[int] = None,
530
+ offset: Optional[int] = None,
531
+ ) -> Any:
532
+ """Plays.
533
+
534
+ Use for play-by-play with nflfastR metrics: EPA, WPA, win probability, success, CPOE, air yards,
535
+ formation flags, and the players involved. Filter by game, or by season plus week/team/player,
536
+ plus play type, down, quarter, win-probability band, red zone, third down. Set include_charting
537
+ for FTN manual charting from 2022 on: alignment, pre-snap motion, play action, screens, run-pass
538
+ options, blitzer counts, drops: or filter directly on those flags. Returns a per-query EPA and
539
+ success-rate summary. Paginate with offset. Costs 10 credits.
540
+
541
+ Costs 10 credits per call.
542
+
543
+ Args:
544
+ game_id (optional): Game id, e.g. 2025_01_KC_BUF
545
+ season (optional): Season year (required when game_id is not set)
546
+ week (optional): Week
547
+ posteam (optional): Offense team code
548
+ defteam (optional): Defense team code
549
+ play_type (optional): Play type. One of: pass, run, punt, kickoff, field_goal, extra_point,
550
+ qb_kneel, qb_spike, no_play.
551
+ down (optional): Down
552
+ quarter (optional): Quarter (5+ = overtime)
553
+ passer_id (optional): GSIS id of the passer
554
+ rusher_id (optional): GSIS id of the rusher
555
+ receiver_id (optional): GSIS id of the receiver
556
+ min_wp (optional): Minimum pre-play win probability for the offense
557
+ max_wp (optional): Maximum pre-play win probability
558
+ red_zone (optional): Only plays inside the 20
559
+ third_down (optional): Only third downs
560
+ include_charting (optional): Attach FTN manual charting to each play (2022+): alignment,
561
+ motion, play action, screens, RPO, blitzers, drops
562
+ is_play_action (optional): Charting filter: play action (2022+)
563
+ is_motion (optional): Charting filter: pre-snap motion (2022+)
564
+ is_rpo (optional): Charting filter: run-pass option (2022+)
565
+ is_screen_pass (optional): Charting filter: screen pass (2022+)
566
+ is_no_huddle (optional): Charting filter: no huddle (2022+)
567
+ is_trick_play (optional): Charting filter: trick play (2022+)
568
+ is_qb_out_of_pocket (optional): Charting filter: quarterback out of the pocket (2022+)
569
+ is_drop (optional): Charting filter: charted drop (2022+)
570
+ min_blitzers (optional): Charting filter: at least this many blitzers (2022+). FTN counts
571
+ rushers beyond the base rush, so this is typically 0-3; 5+ is almost never charted.
572
+ limit (optional): Max plays (default 200)
573
+ offset (optional): Pagination offset
574
+
575
+ Returns:
576
+ The unwrapped ``data`` object from the response.
577
+ """
578
+ return self._call(
579
+ "get_plays",
580
+ {
581
+ "game_id": game_id,
582
+ "season": season,
583
+ "week": week,
584
+ "posteam": posteam,
585
+ "defteam": defteam,
586
+ "play_type": play_type,
587
+ "down": down,
588
+ "quarter": quarter,
589
+ "passer_id": passer_id,
590
+ "rusher_id": rusher_id,
591
+ "receiver_id": receiver_id,
592
+ "min_wp": min_wp,
593
+ "max_wp": max_wp,
594
+ "red_zone": red_zone,
595
+ "third_down": third_down,
596
+ "include_charting": include_charting,
597
+ "is_play_action": is_play_action,
598
+ "is_motion": is_motion,
599
+ "is_rpo": is_rpo,
600
+ "is_screen_pass": is_screen_pass,
601
+ "is_no_huddle": is_no_huddle,
602
+ "is_trick_play": is_trick_play,
603
+ "is_qb_out_of_pocket": is_qb_out_of_pocket,
604
+ "is_drop": is_drop,
605
+ "min_blitzers": min_blitzers,
606
+ "limit": limit,
607
+ "offset": offset,
608
+ },
609
+ )
610
+
611
+ def get_advanced_stats(
612
+ self,
613
+ source: Literal["ngs_passing", "ngs_rushing", "ngs_receiving", "pfr_passing", "pfr_rushing", "pfr_receiving", "pfr_defense"],
614
+ *,
615
+ season: Optional[Union[str, int, float]] = None,
616
+ week: Optional[int] = None,
617
+ player_id: Optional[str] = None,
618
+ team: Optional[str] = None,
619
+ limit: Optional[int] = None,
620
+ ) -> Any:
621
+ """Advanced stats.
622
+
623
+ Use for tracking and charting metrics the box score does not carry. Next Gen Stats (2016+): time
624
+ to throw, air yards, completion percentage above expectation, separation, cushion, rush yards
625
+ over expected. Pro Football Reference advanced (2018+): pressures, hurries, blitzes, drops, bad
626
+ throws, missed tackles, coverage yards allowed. Pick a source, then filter by season, week,
627
+ player or team. Costs 5 credits.
628
+
629
+ Costs 5 credits per call.
630
+
631
+ Args:
632
+ source: Which dataset: ngs_passing, ngs_rushing, ngs_receiving, pfr_passing, pfr_rushing,
633
+ pfr_receiving, pfr_defense
634
+ season (optional): Season year. Defaults to current. NGS from 2016, PFR from 2018.
635
+ week (optional): Week. NGS also publishes week 0 as the season aggregate.
636
+ player_id (optional): GSIS id for an ngs_* source, PFR id for a pfr_* source; both are on
637
+ search_players
638
+ team (optional): Team code
639
+ limit (optional): Max rows (default 50)
640
+
641
+ Returns:
642
+ The unwrapped ``data`` object from the response.
643
+ """
644
+ return self._call(
645
+ "get_advanced_stats",
646
+ {
647
+ "source": source,
648
+ "season": season,
649
+ "week": week,
650
+ "player_id": player_id,
651
+ "team": team,
652
+ "limit": limit,
653
+ },
654
+ )
655
+
656
+ def get_odds(
657
+ self,
658
+ *,
659
+ game_id: Optional[str] = None,
660
+ season: Optional[Union[str, int, float]] = None,
661
+ team: Optional[str] = None,
662
+ bookmaker: Optional[str] = None,
663
+ snapshot_type: Optional[Literal["opening", "closing", "latest"]] = None,
664
+ limit: Optional[int] = None,
665
+ offset: Optional[int] = None,
666
+ estimate_only: Optional[bool] = None,
667
+ ) -> Any:
668
+ """Odds.
669
+
670
+ Use for betting lines. Pass game_id for one game (10 credits): the consensus closing spread and
671
+ total (every game since 1999; moneyline every game since 2010) plus each sportsbook's closing
672
+ line from the 2014 season (4-9 books for 2014-2019, closing only) and per-bookmaker opening,
673
+ closing and latest lines from the 2020 season (up to 8 books, including Pinnacle). Or pass
674
+ season (optionally team) for a season of per-book closing lines in one call, with final scores
675
+ and the consensus close, at 10 credits per game returned, 100 games a page by default (up to
676
+ 500); each book's line is an array in the order given by columns. Each line says its source:
677
+ espn (2014-2019 closing lines) or the_odds_api (from 2020); a season answer lists each game's
678
+ sources. For consensus closing lines only, get_games returns a whole season for 5 credits. Set
679
+ estimate_only to get the price without being charged.
680
+
681
+ Costs 10 credits per call.
682
+
683
+ Args:
684
+ game_id (optional): Game id, e.g. 2026_01_KC_BUF. Omit and pass season for a whole season.
685
+ season (optional): Season year for a whole season of per-book lines, e.g. 2026. Used when
686
+ game_id is not set.
687
+ team (optional): With season: only this team's games (e.g. KC).
688
+ bookmaker (optional): Bookmaker key (draftkings, fanduel, betmgm, espnbet, pinnacle, bovada,
689
+ betonlineag, mybookieag; for 2014-2019 also westgate, caesars, wynn, unibet, 5dimes,
690
+ sportsbettingag and others)
691
+ snapshot_type (optional): Single game: one snapshot type (default all). Season: opening or
692
+ closing (default closing). One of: opening, closing, latest.
693
+ limit (optional): With season: games per page (default 100, max 500).
694
+ offset (optional): With season: page offset; use next_offset from the previous page.
695
+ estimate_only (optional): Return what this call would cost, without charging or running it.
696
+
697
+ Returns:
698
+ The unwrapped ``data`` object from the response.
699
+ """
700
+ return self._call(
701
+ "get_odds",
702
+ {
703
+ "game_id": game_id,
704
+ "season": season,
705
+ "team": team,
706
+ "bookmaker": bookmaker,
707
+ "snapshot_type": snapshot_type,
708
+ "limit": limit,
709
+ "offset": offset,
710
+ "estimate_only": estimate_only,
711
+ },
712
+ )
713
+
714
+ def get_line_movement(
715
+ self,
716
+ game_id: str,
717
+ *,
718
+ bookmaker: Optional[str] = None,
719
+ ) -> Any:
720
+ """Line movement.
721
+
722
+ Use to see how a game's lines moved: the full time series of hourly snapshots grouped by
723
+ bookmaker. Most expensive tool (25 cr); use get_odds (10 cr) if you only need opening, closing,
724
+ or current lines.
725
+
726
+ Costs 25 credits per call.
727
+
728
+ Args:
729
+ game_id: Game id
730
+ bookmaker (optional): Bookmaker key filter
731
+
732
+ Returns:
733
+ The unwrapped ``data`` object from the response.
734
+ """
735
+ return self._call(
736
+ "get_line_movement",
737
+ {
738
+ "game_id": game_id,
739
+ "bookmaker": bookmaker,
740
+ },
741
+ )
742
+
743
+ def get_player_props(
744
+ self,
745
+ *,
746
+ game_id: Optional[str] = None,
747
+ player_id: Optional[str] = None,
748
+ season: Optional[Union[str, int, float]] = None,
749
+ market: Optional[Literal["player_pass_yds", "player_pass_tds", "player_rush_yds", "player_reception_yds", "player_receptions", "player_anytime_td"]] = None,
750
+ bookmaker: Optional[str] = None,
751
+ snapshot_type: Optional[Literal["opening", "closing"]] = None,
752
+ estimate_only: Optional[bool] = None,
753
+ ) -> Any:
754
+ """Player props.
755
+
756
+ Use for player prop lines by sportsbook: over/under on passing yards, passing TDs, rushing
757
+ yards, receiving yards and receptions, plus anytime TD, from the 2023 season (7 books:
758
+ DraftKings, FanDuel, BetMGM, ESPN BET, Pinnacle, Bovada, BetOnline). Pass game_id for every
759
+ player's props in one game (10 credits), or player_id with season for one player across a season
760
+ (10 credits per game returned). Returns the closing line by default (the last before kickoff) or
761
+ the opening line. Set estimate_only to get the price without being charged.
762
+
763
+ Costs 10 credits per call.
764
+
765
+ Args:
766
+ game_id (optional): Game id, e.g. 2025_01_KC_LAC.
767
+ player_id (optional): GSIS player id (00-00XXXXX) from search_players. With season: that
768
+ player's props across the season.
769
+ season (optional): Season year, with player_id.
770
+ market (optional): One market: player_pass_yds (passing yards), player_pass_tds (passing
771
+ touchdowns), player_rush_yds (rushing yards), player_reception_yds (receiving yards),
772
+ player_receptions (receptions), player_anytime_td (anytime touchdown (over = scores))
773
+ bookmaker (optional): Bookmaker key, e.g. draftkings, fanduel, pinnacle.
774
+ snapshot_type (optional): closing (default): the last line before kickoff. opening: the
775
+ first one captured.
776
+ estimate_only (optional): Return what this call would cost, without charging or running it.
777
+
778
+ Returns:
779
+ The unwrapped ``data`` object from the response.
780
+ """
781
+ return self._call(
782
+ "get_player_props",
783
+ {
784
+ "game_id": game_id,
785
+ "player_id": player_id,
786
+ "season": season,
787
+ "market": market,
788
+ "bookmaker": bookmaker,
789
+ "snapshot_type": snapshot_type,
790
+ "estimate_only": estimate_only,
791
+ },
792
+ )
793
+
794
+ def get_prop_history(
795
+ self,
796
+ player_id: str,
797
+ market: Literal["player_pass_yds", "player_pass_tds", "player_pass_completions", "player_pass_attempts", "player_pass_interceptions", "player_rush_yds", "player_rush_attempts", "player_receptions", "player_reception_yds", "player_anytime_td"],
798
+ *,
799
+ from_date: Optional[str] = None,
800
+ to_date: Optional[str] = None,
801
+ bookmaker: Optional[str] = None,
802
+ limit: Optional[int] = None,
803
+ ) -> Any:
804
+ """Prop history.
805
+
806
+ Use to see how a player did against his prop line over time: for one market (passing, rushing or
807
+ receiving yards, passing touchdowns, completions, attempts, interceptions, carries, receptions
808
+ or anytime touchdown), one row per game with the closing line (the median across books, or one
809
+ book's), the opening line, the prices, what the player actually recorded from our box scores and
810
+ the result against the line, plus the over rate. Costs 10 credits for up to 200 games.
811
+
812
+ Costs 10 credits per call.
813
+
814
+ Args:
815
+ player_id: Player id (a GSIS id such as 00-0033873) from search_players.
816
+ market: The market: player_pass_yds (passing yards), player_pass_tds (passing touchdowns),
817
+ player_pass_completions (pass completions), player_pass_attempts (pass attempts),
818
+ player_pass_interceptions (interceptions thrown), player_rush_yds (rushing yards),
819
+ player_rush_attempts (rush attempts), player_receptions (receptions),
820
+ player_reception_yds (receiving yards), player_anytime_td (anytime touchdown (over =
821
+ scores))
822
+ from_date (optional): First date, YYYY-MM-DD (the game's date).
823
+ to_date (optional): Last date, YYYY-MM-DD (the game's date).
824
+ bookmaker (optional): One book's closing line instead of the median across books, e.g.
825
+ draftkings.
826
+ limit (optional): Games to return, oldest first (default 50, max 200). next_from_date says
827
+ where to continue.
828
+
829
+ Returns:
830
+ The unwrapped ``data`` object from the response.
831
+ """
832
+ return self._call(
833
+ "get_prop_history",
834
+ {
835
+ "player_id": player_id,
836
+ "market": market,
837
+ "from_date": from_date,
838
+ "to_date": to_date,
839
+ "bookmaker": bookmaker,
840
+ "limit": limit,
841
+ },
842
+ )
843
+
844
+ def get_alt_lines(
845
+ self,
846
+ game_id: str,
847
+ *,
848
+ market: Optional[Literal["alternate_spreads", "alternate_totals"]] = None,
849
+ bookmaker: Optional[str] = None,
850
+ snapshot_type: Optional[Literal["opening", "closing"]] = None,
851
+ ) -> Any:
852
+ """Alt lines.
853
+
854
+ Use for alternate spreads and totals by sportsbook: every point on each book's ladder with its
855
+ price (e.g. KC -10.5 at +260, over 51.5 at +140), for one game, from the 2023 to 2025 seasons (6
856
+ books: FanDuel, DraftKings, BetMGM, Bovada, Pinnacle, ESPN BET). Returns each book's closing
857
+ ladder by default (the last before kickoff) or its opening one. side is home or away for spreads
858
+ (point is that side's spread) and over or under for totals. 10 credits.
859
+
860
+ Costs 10 credits per call.
861
+
862
+ Args:
863
+ game_id: Game id, e.g. 2025_01_KC_LAC.
864
+ market (optional): One market (default both). One of: alternate_spreads, alternate_totals.
865
+ bookmaker (optional): Bookmaker key: fanduel, draftkings, betmgm, bovada, pinnacle, espnbet.
866
+ snapshot_type (optional): closing (default): each book's last ladder before kickoff.
867
+ opening: its first.
868
+
869
+ Returns:
870
+ The unwrapped ``data`` object from the response.
871
+ """
872
+ return self._call(
873
+ "get_alt_lines",
874
+ {
875
+ "game_id": game_id,
876
+ "market": market,
877
+ "bookmaker": bookmaker,
878
+ "snapshot_type": snapshot_type,
879
+ },
880
+ )