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/__init__.py +25 -0
- endzoneapi/_core.py +307 -0
- endzoneapi/_version.py +1 -0
- endzoneapi/client.py +880 -0
- endzoneapi/py.typed +0 -0
- endzoneapi-0.1.0.dist-info/METADATA +204 -0
- endzoneapi-0.1.0.dist-info/RECORD +9 -0
- endzoneapi-0.1.0.dist-info/WHEEL +4 -0
- endzoneapi-0.1.0.dist-info/licenses/LICENSE +21 -0
endzoneapi/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: endzoneapi
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python client for the EndzoneAPI NFL data API. No dependencies.
|
|
5
|
+
Project-URL: Homepage, https://endzoneapi.com
|
|
6
|
+
Project-URL: Documentation, https://endzoneapi.com/docs
|
|
7
|
+
Project-URL: Repository, https://github.com/noahowsh/puckapi
|
|
8
|
+
Project-URL: Sign up, https://endzoneapi.com/signup
|
|
9
|
+
Author-email: EndzoneAPI <support@endzoneapi.com>
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: api-client,betting,endzoneapi,nfl,odds,player-props,sports-data
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Classifier: Typing :: Typed
|
|
24
|
+
Requires-Python: >=3.9
|
|
25
|
+
Provides-Extra: pandas
|
|
26
|
+
Requires-Dist: pandas>=1.5; extra == 'pandas'
|
|
27
|
+
Provides-Extra: test
|
|
28
|
+
Requires-Dist: pytest>=7; extra == 'test'
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
# EndzoneAPI for Python
|
|
32
|
+
|
|
33
|
+
Python client for the [EndzoneAPI](https://endzoneapi.com) NFL data API. It has no required dependencies (standard library only) and works on Python 3.9 and newer. Pandas is optional.
|
|
34
|
+
|
|
35
|
+
## Install
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pip install endzoneapi
|
|
39
|
+
pip install "endzoneapi[pandas]" # only if you want DataFrames
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Set your key
|
|
43
|
+
|
|
44
|
+
Get a free key at https://endzoneapi.com/signup. Free accounts get 500 credits a month.
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
export ENDZONEAPI_API_KEY=your_key_here
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
from endzoneapi import Client
|
|
52
|
+
|
|
53
|
+
client = Client() # reads ENDZONEAPI_API_KEY
|
|
54
|
+
client = Client(api_key="your_key") # or pass it in
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Examples
|
|
58
|
+
|
|
59
|
+
### 1. Player props for one game
|
|
60
|
+
|
|
61
|
+
`get_player_props` returns every player's line, by sportsbook, for one market. Pass `estimate_only=True` first to see the credit cost without being charged.
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
from endzoneapi import Client, to_dataframe
|
|
65
|
+
|
|
66
|
+
client = Client()
|
|
67
|
+
|
|
68
|
+
print(client.get_player_props(game_id="2025_01_KC_LAC", estimate_only=True))
|
|
69
|
+
|
|
70
|
+
props = client.get_player_props(
|
|
71
|
+
game_id="2025_01_KC_LAC",
|
|
72
|
+
market="player_pass_yds",
|
|
73
|
+
bookmaker="draftkings",
|
|
74
|
+
)
|
|
75
|
+
df = to_dataframe(props, key="props")
|
|
76
|
+
print(df[["player_name", "line", "over_odds", "under_odds"]])
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 2. Props for every game in a week
|
|
80
|
+
|
|
81
|
+
Loop over a week of games and stack the results. This is the usual shape of a props model's data pull.
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
import pandas as pd
|
|
85
|
+
from endzoneapi import Client, to_dataframe
|
|
86
|
+
|
|
87
|
+
client = Client()
|
|
88
|
+
|
|
89
|
+
games = client.get_games(season=2025, week=1, limit=2)["games"]
|
|
90
|
+
frames = []
|
|
91
|
+
for game in games:
|
|
92
|
+
props = client.get_player_props(game_id=game["game_id"], market="player_rush_yds")
|
|
93
|
+
frames.append(to_dataframe(props, key="props"))
|
|
94
|
+
week = pd.concat(frames, ignore_index=True)
|
|
95
|
+
print(len(week), "lines from", len(games), "games")
|
|
96
|
+
print(week.groupby("bookmaker").size())
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 3. Find a player, then pull his stats
|
|
100
|
+
|
|
101
|
+
Player ids are GSIS ids. `search_players` finds them by name.
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
from endzoneapi import Client
|
|
105
|
+
|
|
106
|
+
client = Client()
|
|
107
|
+
|
|
108
|
+
mahomes = client.search_players("Mahomes", limit=1)["players"][0]
|
|
109
|
+
stats = client.get_player_stats(mahomes["player_id"], season=2025)
|
|
110
|
+
print(mahomes["name"], mahomes["team"])
|
|
111
|
+
print(stats)
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Credits
|
|
115
|
+
|
|
116
|
+
Every method returns the `data` object from the response. After each call, `client.last_credits_used` and `client.last_credits_remaining` hold the counters from the `X-Credits-Used` and `X-Credits-Remaining` headers. Methods that take `estimate_only=True` return the price of a call without running or charging it.
|
|
117
|
+
|
|
118
|
+
## Pandas
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
from endzoneapi import to_dataframe
|
|
122
|
+
|
|
123
|
+
df = to_dataframe(data) # finds the main list in the response
|
|
124
|
+
df = to_dataframe(data, key="rows") # or name the list yourself
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Nested fields become dotted columns. Install pandas separately or with `pip install "endzoneapi[pandas]"`.
|
|
128
|
+
|
|
129
|
+
## Errors
|
|
130
|
+
|
|
131
|
+
Every error is an `APIError` subclass, with the server's message and the HTTP status.
|
|
132
|
+
|
|
133
|
+
| Exception | Status | Meaning |
|
|
134
|
+
| --- | --- | --- |
|
|
135
|
+
| `AuthError` | 401 | Missing, invalid or revoked key |
|
|
136
|
+
| `InsufficientCreditsError` | 402 | Not enough credits for the call |
|
|
137
|
+
| `NotFoundError` | 404 | The id or name does not exist |
|
|
138
|
+
| `RateLimitError` | 429 | Too many requests; has `.retry_after` when the server sends it |
|
|
139
|
+
| `APIError` | 400, 5xx | Bad arguments or a server problem |
|
|
140
|
+
| `APIConnectionError` | none | No response (network or timeout) |
|
|
141
|
+
|
|
142
|
+
```python
|
|
143
|
+
from endzoneapi import Client, APIError, InsufficientCreditsError, RateLimitError
|
|
144
|
+
|
|
145
|
+
client = Client()
|
|
146
|
+
try:
|
|
147
|
+
data = client.list_teams()
|
|
148
|
+
except InsufficientCreditsError:
|
|
149
|
+
print("Out of credits, top up at https://endzoneapi.com")
|
|
150
|
+
except RateLimitError as exc:
|
|
151
|
+
print("Slow down, retry after", exc.retry_after)
|
|
152
|
+
except APIError as exc:
|
|
153
|
+
print(exc.status_code, exc.message)
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
The client retries 429 and 5xx responses and connection failures up to 3 times with backoff, and honors `Retry-After`. Set `Client(max_retries=0)` to turn that off.
|
|
157
|
+
|
|
158
|
+
If you see `CERTIFICATE_VERIFY_FAILED` on a python.org install for macOS, run the "Install Certificates.command" script that came with Python, or `pip install certifi` (the client uses it when present).
|
|
159
|
+
|
|
160
|
+
## Options
|
|
161
|
+
|
|
162
|
+
```python
|
|
163
|
+
Client(
|
|
164
|
+
api_key=None, # defaults to $ENDZONEAPI_API_KEY
|
|
165
|
+
base_url="https://mcp.endzoneapi.com", # point at another host
|
|
166
|
+
timeout=60.0, # seconds per request
|
|
167
|
+
max_retries=3,
|
|
168
|
+
)
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
`client.call("tool_name", {"arg": "value"})` calls any tool by name, which helps when the API adds a tool before this package does.
|
|
172
|
+
|
|
173
|
+
## Tools
|
|
174
|
+
|
|
175
|
+
Method names match the API tool names. Arguments are keyword arguments; required ones can also be passed positionally. Each method's docstring lists its arguments (`help(client.list_teams)`).
|
|
176
|
+
|
|
177
|
+
| Method | Credits | What it does |
|
|
178
|
+
| --- | --- | --- |
|
|
179
|
+
| `list_teams` | 1 | List teams |
|
|
180
|
+
| `get_standings` | 2 | Standings |
|
|
181
|
+
| `get_team_stats` | 5 | Team stats |
|
|
182
|
+
| `get_games` | 5 | Games |
|
|
183
|
+
| `get_schedule` | 2 | Schedule |
|
|
184
|
+
| `get_game_detail` | 10 | Game detail |
|
|
185
|
+
| `get_head_to_head` | 10 | Head to head |
|
|
186
|
+
| `search_players` | 2 | Search players |
|
|
187
|
+
| `get_player_stats` | 5 | Player stats |
|
|
188
|
+
| `get_player_leaders` | 5 | Player leaders |
|
|
189
|
+
| `get_injuries` | 2 | Injuries |
|
|
190
|
+
| `get_depth_chart` | 2 | Depth chart |
|
|
191
|
+
| `get_snap_counts` | 5 | Snap counts |
|
|
192
|
+
| `get_plays` | 10 | Plays |
|
|
193
|
+
| `get_advanced_stats` | 5 | Advanced stats |
|
|
194
|
+
| `get_odds` | 10 | Odds |
|
|
195
|
+
| `get_line_movement` | 25 | Line movement |
|
|
196
|
+
| `get_player_props` | 10 | Player props |
|
|
197
|
+
| `get_prop_history` | 10 | Prop history |
|
|
198
|
+
| `get_alt_lines` | 10 | Alt lines |
|
|
199
|
+
|
|
200
|
+
Full API reference: https://endzoneapi.com/docs
|
|
201
|
+
|
|
202
|
+
## License
|
|
203
|
+
|
|
204
|
+
MIT
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
endzoneapi/__init__.py,sha256=GKSbwz-rFkoFmHHjcC8h1ge6s7BkebXwLdiCA7fsRDU,511
|
|
2
|
+
endzoneapi/_core.py,sha256=o0hfEp_PgJO2AjrMBxzThfQMvrVIJ675ttNzyW1h6zs,10609
|
|
3
|
+
endzoneapi/_version.py,sha256=kUR5RAFc7HCeiqdlX36dZOHkUI5wI6V_43RpEcD8b-0,22
|
|
4
|
+
endzoneapi/client.py,sha256=kkZBw71AEb0Rd9LKzjXlw57wOXs8p9OvjYrQc3j_gaU,34076
|
|
5
|
+
endzoneapi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
endzoneapi-0.1.0.dist-info/METADATA,sha256=K4lVrf7XruE22i8_WOmiR2FghPP7X4_eGpe3Td4h2wM,6914
|
|
7
|
+
endzoneapi-0.1.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
8
|
+
endzoneapi-0.1.0.dist-info/licenses/LICENSE,sha256=i0Bib7q00hfK1xVtVrQPJLjgXysGeSp2u7_S8knZMF8,1067
|
|
9
|
+
endzoneapi-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 EndzoneAPI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|