birdieapi 0.1.0__tar.gz

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.
@@ -0,0 +1,6 @@
1
+ __pycache__/
2
+ *.egg-info/
3
+ .pytest_cache/
4
+ .venv/
5
+ dist/
6
+ build/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 BirdieAPI
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.
@@ -0,0 +1,184 @@
1
+ Metadata-Version: 2.5
2
+ Name: birdieapi
3
+ Version: 0.1.0
4
+ Summary: Python client for the BirdieAPI golf data API. No dependencies.
5
+ Project-URL: Homepage, https://birdieapi.com
6
+ Project-URL: Documentation, https://birdieapi.com/docs
7
+ Project-URL: Repository, https://github.com/noahowsh/puckapi
8
+ Project-URL: Sign up, https://birdieapi.com/signup
9
+ Author-email: BirdieAPI <support@birdieapi.com>
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: api-client,betting,birdieapi,golf,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
+ # BirdieAPI for Python
32
+
33
+ Python client for the [BirdieAPI](https://birdieapi.com) golf 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 birdieapi
39
+ pip install "birdieapi[pandas]" # only if you want DataFrames
40
+ ```
41
+
42
+ ## Set your key
43
+
44
+ Get a free key at https://birdieapi.com/signup. Free accounts get 500 credits a month.
45
+
46
+ ```bash
47
+ export BIRDIEAPI_API_KEY=your_key_here
48
+ ```
49
+
50
+ ```python
51
+ from birdieapi import Client
52
+
53
+ client = Client() # reads BIRDIEAPI_API_KEY
54
+ client = Client(api_key="your_key") # or pass it in
55
+ ```
56
+
57
+ ## Examples
58
+
59
+ ### 1. Recent tournaments
60
+
61
+ `list_tournaments` filters by season and status.
62
+
63
+ ```python
64
+ from birdieapi import Client
65
+
66
+ client = Client()
67
+
68
+ events = client.list_tournaments(status="final", limit=3)["tournaments"]
69
+ for e in events:
70
+ print(e["tournament_id"], e["name"], e["winner_name"], e["winning_to_par"])
71
+ ```
72
+
73
+ ### 2. A leaderboard
74
+
75
+ Pass a tournament id from `list_tournaments`.
76
+
77
+ ```python
78
+ from birdieapi import Client, to_dataframe
79
+
80
+ client = Client()
81
+
82
+ board = client.get_leaderboard("401850916", limit=10)
83
+ print(to_dataframe(board).head(10))
84
+ ```
85
+
86
+ ### 3. A player's results
87
+
88
+ Find the player id with `search_players`, then pull his results for a season.
89
+
90
+ ```python
91
+ from birdieapi import Client
92
+
93
+ client = Client()
94
+
95
+ scheffler = client.search_players("Scheffler", limit=1)["players"][0]
96
+ results = client.get_player_results(scheffler["player_id"], season=2026, limit=5)
97
+ print(scheffler["name"], results)
98
+ ```
99
+
100
+ ## Credits
101
+
102
+ 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.
103
+
104
+ ## Pandas
105
+
106
+ ```python
107
+ from birdieapi import to_dataframe
108
+
109
+ df = to_dataframe(data) # finds the main list in the response
110
+ df = to_dataframe(data, key="rows") # or name the list yourself
111
+ ```
112
+
113
+ Nested fields become dotted columns. Install pandas separately or with `pip install "birdieapi[pandas]"`.
114
+
115
+ ## Errors
116
+
117
+ Every error is an `APIError` subclass, with the server's message and the HTTP status.
118
+
119
+ | Exception | Status | Meaning |
120
+ | --- | --- | --- |
121
+ | `AuthError` | 401 | Missing, invalid or revoked key |
122
+ | `InsufficientCreditsError` | 402 | Not enough credits for the call |
123
+ | `NotFoundError` | 404 | The id or name does not exist |
124
+ | `RateLimitError` | 429 | Too many requests; has `.retry_after` when the server sends it |
125
+ | `APIError` | 400, 5xx | Bad arguments or a server problem |
126
+ | `APIConnectionError` | none | No response (network or timeout) |
127
+
128
+ ```python
129
+ from birdieapi import Client, APIError, InsufficientCreditsError, RateLimitError
130
+
131
+ client = Client()
132
+ try:
133
+ data = client.list_tournaments()
134
+ except InsufficientCreditsError:
135
+ print("Out of credits, top up at https://birdieapi.com")
136
+ except RateLimitError as exc:
137
+ print("Slow down, retry after", exc.retry_after)
138
+ except APIError as exc:
139
+ print(exc.status_code, exc.message)
140
+ ```
141
+
142
+ 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.
143
+
144
+ 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).
145
+
146
+ ## Options
147
+
148
+ ```python
149
+ Client(
150
+ api_key=None, # defaults to $BIRDIEAPI_API_KEY
151
+ base_url="https://mcp.birdieapi.com", # point at another host
152
+ timeout=60.0, # seconds per request
153
+ max_retries=3,
154
+ )
155
+ ```
156
+
157
+ `client.call("tool_name", {"arg": "value"})` calls any tool by name, which helps when the API adds a tool before this package does.
158
+
159
+ ## Tools
160
+
161
+ 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_tournaments)`).
162
+
163
+ | Method | Credits | What it does |
164
+ | --- | --- | --- |
165
+ | `list_tournaments` | 1 | List tournaments |
166
+ | `get_schedule` | 1 | Schedule |
167
+ | `get_leaderboard` | 2 | Leaderboard |
168
+ | `get_course` | 2 | Course |
169
+ | `search_players` | 1 | Search players |
170
+ | `get_player` | 5 | Player |
171
+ | `get_player_results` | 5 | Player results |
172
+ | `get_player_stats` | 5 | Player stats |
173
+ | `get_scorecard` | 2 | Scorecard |
174
+ | `get_course_history` | 5 | Course history |
175
+ | `get_head_to_head` | 5 | Head to head |
176
+ | `get_ratings` | 2 | Ratings |
177
+ | `get_leaders` | 5 | Leaders |
178
+ | `get_winner_odds` | 5 | Winner odds |
179
+
180
+ Full API reference: https://birdieapi.com/docs
181
+
182
+ ## License
183
+
184
+ MIT
@@ -0,0 +1,154 @@
1
+ # BirdieAPI for Python
2
+
3
+ Python client for the [BirdieAPI](https://birdieapi.com) golf data API. It has no required dependencies (standard library only) and works on Python 3.9 and newer. Pandas is optional.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pip install birdieapi
9
+ pip install "birdieapi[pandas]" # only if you want DataFrames
10
+ ```
11
+
12
+ ## Set your key
13
+
14
+ Get a free key at https://birdieapi.com/signup. Free accounts get 500 credits a month.
15
+
16
+ ```bash
17
+ export BIRDIEAPI_API_KEY=your_key_here
18
+ ```
19
+
20
+ ```python
21
+ from birdieapi import Client
22
+
23
+ client = Client() # reads BIRDIEAPI_API_KEY
24
+ client = Client(api_key="your_key") # or pass it in
25
+ ```
26
+
27
+ ## Examples
28
+
29
+ ### 1. Recent tournaments
30
+
31
+ `list_tournaments` filters by season and status.
32
+
33
+ ```python
34
+ from birdieapi import Client
35
+
36
+ client = Client()
37
+
38
+ events = client.list_tournaments(status="final", limit=3)["tournaments"]
39
+ for e in events:
40
+ print(e["tournament_id"], e["name"], e["winner_name"], e["winning_to_par"])
41
+ ```
42
+
43
+ ### 2. A leaderboard
44
+
45
+ Pass a tournament id from `list_tournaments`.
46
+
47
+ ```python
48
+ from birdieapi import Client, to_dataframe
49
+
50
+ client = Client()
51
+
52
+ board = client.get_leaderboard("401850916", limit=10)
53
+ print(to_dataframe(board).head(10))
54
+ ```
55
+
56
+ ### 3. A player's results
57
+
58
+ Find the player id with `search_players`, then pull his results for a season.
59
+
60
+ ```python
61
+ from birdieapi import Client
62
+
63
+ client = Client()
64
+
65
+ scheffler = client.search_players("Scheffler", limit=1)["players"][0]
66
+ results = client.get_player_results(scheffler["player_id"], season=2026, limit=5)
67
+ print(scheffler["name"], results)
68
+ ```
69
+
70
+ ## Credits
71
+
72
+ 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.
73
+
74
+ ## Pandas
75
+
76
+ ```python
77
+ from birdieapi import to_dataframe
78
+
79
+ df = to_dataframe(data) # finds the main list in the response
80
+ df = to_dataframe(data, key="rows") # or name the list yourself
81
+ ```
82
+
83
+ Nested fields become dotted columns. Install pandas separately or with `pip install "birdieapi[pandas]"`.
84
+
85
+ ## Errors
86
+
87
+ Every error is an `APIError` subclass, with the server's message and the HTTP status.
88
+
89
+ | Exception | Status | Meaning |
90
+ | --- | --- | --- |
91
+ | `AuthError` | 401 | Missing, invalid or revoked key |
92
+ | `InsufficientCreditsError` | 402 | Not enough credits for the call |
93
+ | `NotFoundError` | 404 | The id or name does not exist |
94
+ | `RateLimitError` | 429 | Too many requests; has `.retry_after` when the server sends it |
95
+ | `APIError` | 400, 5xx | Bad arguments or a server problem |
96
+ | `APIConnectionError` | none | No response (network or timeout) |
97
+
98
+ ```python
99
+ from birdieapi import Client, APIError, InsufficientCreditsError, RateLimitError
100
+
101
+ client = Client()
102
+ try:
103
+ data = client.list_tournaments()
104
+ except InsufficientCreditsError:
105
+ print("Out of credits, top up at https://birdieapi.com")
106
+ except RateLimitError as exc:
107
+ print("Slow down, retry after", exc.retry_after)
108
+ except APIError as exc:
109
+ print(exc.status_code, exc.message)
110
+ ```
111
+
112
+ 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.
113
+
114
+ 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).
115
+
116
+ ## Options
117
+
118
+ ```python
119
+ Client(
120
+ api_key=None, # defaults to $BIRDIEAPI_API_KEY
121
+ base_url="https://mcp.birdieapi.com", # point at another host
122
+ timeout=60.0, # seconds per request
123
+ max_retries=3,
124
+ )
125
+ ```
126
+
127
+ `client.call("tool_name", {"arg": "value"})` calls any tool by name, which helps when the API adds a tool before this package does.
128
+
129
+ ## Tools
130
+
131
+ 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_tournaments)`).
132
+
133
+ | Method | Credits | What it does |
134
+ | --- | --- | --- |
135
+ | `list_tournaments` | 1 | List tournaments |
136
+ | `get_schedule` | 1 | Schedule |
137
+ | `get_leaderboard` | 2 | Leaderboard |
138
+ | `get_course` | 2 | Course |
139
+ | `search_players` | 1 | Search players |
140
+ | `get_player` | 5 | Player |
141
+ | `get_player_results` | 5 | Player results |
142
+ | `get_player_stats` | 5 | Player stats |
143
+ | `get_scorecard` | 2 | Scorecard |
144
+ | `get_course_history` | 5 | Course history |
145
+ | `get_head_to_head` | 5 | Head to head |
146
+ | `get_ratings` | 2 | Ratings |
147
+ | `get_leaders` | 5 | Leaders |
148
+ | `get_winner_odds` | 5 | Winner odds |
149
+
150
+ Full API reference: https://birdieapi.com/docs
151
+
152
+ ## License
153
+
154
+ MIT
@@ -0,0 +1,50 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.27"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "birdieapi"
7
+ dynamic = ["version"]
8
+ description = "Python client for the BirdieAPI golf data API. No dependencies."
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ authors = [{ name = "BirdieAPI", email = "support@birdieapi.com" }]
14
+ keywords = ["golf", "sports-data", "api-client", "betting", "player-props", "odds", "birdieapi"]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Intended Audience :: Developers",
18
+ "Operating System :: OS Independent",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.9",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
25
+ "Topic :: Software Development :: Libraries :: Python Modules",
26
+ "Typing :: Typed",
27
+ ]
28
+ dependencies = []
29
+
30
+ [project.optional-dependencies]
31
+ pandas = ["pandas>=1.5"]
32
+ test = ["pytest>=7"]
33
+
34
+ [project.urls]
35
+ Homepage = "https://birdieapi.com"
36
+ Documentation = "https://birdieapi.com/docs"
37
+ Repository = "https://github.com/noahowsh/puckapi"
38
+ "Sign up" = "https://birdieapi.com/signup"
39
+
40
+ [tool.hatch.version]
41
+ path = "src/birdieapi/_version.py"
42
+
43
+ [tool.hatch.build.targets.wheel]
44
+ packages = ["src/birdieapi"]
45
+
46
+ [tool.hatch.build.targets.sdist]
47
+ include = ["src", "tests", "README.md", "LICENSE", "pyproject.toml"]
48
+
49
+ [tool.pytest.ini_options]
50
+ testpaths = ["tests"]
@@ -0,0 +1,25 @@
1
+ """BirdieAPI: Python client for the BirdieAPI golf data API."""
2
+ from ._core import (
3
+ APIConnectionError,
4
+ APIError,
5
+ AuthError,
6
+ InsufficientCreditsError,
7
+ NotFoundError,
8
+ RateLimitError,
9
+ to_dataframe,
10
+ )
11
+ from ._version import __version__
12
+ from .client import TOOLS, Client
13
+
14
+ __all__ = [
15
+ "APIConnectionError",
16
+ "APIError",
17
+ "AuthError",
18
+ "Client",
19
+ "InsufficientCreditsError",
20
+ "NotFoundError",
21
+ "RateLimitError",
22
+ "TOOLS",
23
+ "__version__",
24
+ "to_dataframe",
25
+ ]