Metadata-Version: 2.5
Name: pitchside
Version: 0.1.3
Summary: A complete, typed Python client for the Big Balls Sports Data API.
Project-URL: Documentation, https://pypi.org/project/pitchside/
Project-URL: Upstream API, https://bigballsdata.com/docs
License-Expression: MIT
License-File: LICENSE
Keywords: api-client,bigballsdata,cricket,football,formula1,mlb,mma,nba,nfl,nhl,odds,soccer,sports,sports-data
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: httpx<0.29,>=0.27
Requires-Dist: pydantic<3,>=2.7
Requires-Dist: tomli>=2.0; python_version < '3.11'
Requires-Dist: typing-extensions>=4.10; python_version < '3.12'
Provides-Extra: all
Requires-Dist: rich>=13.7; extra == 'all'
Requires-Dist: typer>=0.12; extra == 'all'
Provides-Extra: cli
Requires-Dist: rich>=13.7; extra == 'cli'
Requires-Dist: typer>=0.12; extra == 'cli'
Description-Content-Type: text/markdown

# pitchside

A complete, typed Python client for the
[Big Balls Sports Data API](https://bigballsdata.com), covering scores,
odds, stats and intelligence across nine sports behind one consistent
interface.

```python
from pitchside import Pitchside

with Pitchside() as client:  # reads $BIGBALLSDATA_API_KEY
    table = client.standings.get(league="epl")[0]
    for row in table.top(5):
        print(row.rank, row.team_name, row.league_points)
```

```
1 Arsenal 85
2 Manchester City 78
3 Manchester United 71
4 Aston Villa 65
5 Liverpool 60
```

All **118 documented endpoints** are wrapped, sync and async, with a test
that fails if any of them stops being reachable.

---

## Why this exists

The upstream API covers a lot: history back to 1930, Elo models, and a
free tier that reaches most of it. It is also inconsistent between
routes, and absorbing that inconsistency is most of what this library
does.

Measured against the live service rather than the spec:

| The API does this                                                                                                      | pitchside does this                                           |
| ---------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- |
| Uses **five different response envelopes** by route                                                             | Normalises them into one`Envelope`                          |
| Reports "not found" three ways, as a real`404`, a `200` with `data: null`, and a `200` with a zero-filled stub | Raises`NotFoundError` for all three                         |
| Returns`403` with the required plan buried in prose                                                                  | Raises`PlanRequiredError` with `.required_plan == "edge"` |
| Nests collections under route-specific keys such as`data.matches` or `data.leaders`                                | Hands back a plain list                                       |
| Omits the pagination block on list routes that still accept`?offset=`                                                | Synthesises one so`auto_paging_iter()` works anyway         |
| Ships names with leading whitespace, percentages as strings, jersey numbers as either                                  | Normalises on parse                                           |
| Publishes an OpenAPI spec that disagrees with the service                                                              | Models follow the**service** and tolerate both          |

Full detail in [Known upstream issues](#known-upstream-issues).

---

## Install

```bash
pip install pitchside          # library
pip install "pitchside[cli]"   # plus the pitchside command
```

Requires Python 3.10 or newer, and is tested on 3.10 through 3.14. The
runtime dependencies are just `httpx` and `pydantic`, which pull in
nine transitive packages between them.

## Authenticate

Get a key at
[bigballsdata.com/dashboard/keys](https://bigballsdata.com/dashboard/keys).
The free tier allows 1,000 requests a day, or 2,000 if you sign up with
GitHub, and needs no card.

```bash
export BIGBALLSDATA_API_KEY=bbs_live_...
```

```python
Pitchside()  # from the environment
Pitchside(api_key="bbs_live_...")  # explicit
```

The library does not read `.env` for you, because that is the
application's job. Copy [`.env.example`](.env.example) if you want one.

---

## Configuration keys

Three environment variables, and nothing else. `pitchside.ENV_VARS` is
the registry, and a test fails if the library ever reads one that is not
listed there.

| Variable | Purpose |
|---|---|
| `BIGBALLSDATA_API_KEY` | API key. Checked first. |
| `PITCHSIDE_API_KEY` | API key. Checked when the above is unset. |
| `PITCHSIDE_BASE_URL` | Overrides the gateway URL. Useful for a local mock. |

```python
>>> from pitchside import ENV_VARS
>>> for name, purpose in ENV_VARS.items():
...     print(name, "-", purpose)
```

`PITCHSIDE_WEBHOOK_SECRET` appears in the webhook examples as a
convention. The library never reads it, because the secret belongs to
your handler rather than to the client.

### Loading it explicitly

The constructor reads the environment as a fallback, which is convenient
until the wrong key is in play and there is nothing to inspect.
`Settings` makes the same resolution explicit and shows its work.

```python
from pitchside import Settings

settings = Settings.load()
print(settings.explain())
```

```
Settings
  api_key        bbs_live_…8f2a   [env:BIGBALLSDATA_API_KEY]
  base_url       https://api.bigballsdata.com   [default]
  timeout        90   [file:pitchside.toml]
  max_retries    5   [file:pitchside.toml]
  cache_enabled  True   [default]
```

Four layers, each overriding the one before:

```
defaults  <  config file  <  environment  <  explicit arguments
```

Shortcuts on both clients:

```python
Pitchside.from_env()  # environment only, no files
Pitchside.from_env(dotenv=".env")  # .env, then environment
Pitchside.from_file("pitchside.toml")  # that file, then environment
Pitchside.from_file()  # discover a file, then environment
AsyncPitchside.from_file()  # same, async
```

Which layers each entry point reads:

| Call | Config file | `.env` | Environment |
|---|---|---|---|
| `Pitchside()` | no | no | yes |
| `Pitchside.from_env()` | **no** | only if named | yes |
| `Pitchside.from_file()` | yes, discovered | only if named | yes |
| `Settings.load()` | yes, discovered | only if named | yes |
| `Settings.load(path=False)` | no | only if named | yes |
| `Settings.load(use_env=False)` | yes | only if named | no |

A `.env` is never read unless you name it, and when you do it feeds the
environment layer rather than being a layer of its own. `explain()`
marks such values `via .env`, so the trail stays visible.

### Config file

TOML, either a dedicated file or a `[tool.pitchside]` table in an
existing `pyproject.toml`. `pitchside.toml`, `.pitchside.toml` and
`pyproject.toml` are searched in that order.

```toml
# pitchside.toml
timeout = 90
max_retries = 5

[cache]
enabled = true
ttls = { "^/v1/standings$" = 60 }
```

Two further variables are read only through this loader, never by the
client directly: `PITCHSIDE_TIMEOUT`, `PITCHSIDE_MAX_RETRIES` and
`PITCHSIDE_CACHE`.

Keep the key out of the file. A committed key is one push from being
public, so `Settings.load()` warns if it reads `api_key` from a file git
is tracking. The environment, or an ignored `.env`, is the right home.

### .env

Not read unless you ask, because a library should not reach into the
environment behind your back.

```python
from pitchside import load_dotenv

load_dotenv(".env")  # existing variables win
load_dotenv(".env", override=True)  # the file wins
```

The parser handles `KEY=value`, `export KEY=value`, comments, blank
lines and quoted values. It does no interpolation and no multi-line
values; reach for a dedicated `.env` library if you need those.

---

## Sync and async

Every method exists in both flavours with the same name and signature,
and a test enforces that they never drift apart.

```python
import asyncio
from pitchside import AsyncPitchside


async def main():
    async with AsyncPitchside() as client:
        # The API takes 150 to 400ms per call, so concurrency pays.
        sports, leagues, health = await asyncio.gather(
            client.sports.list(),
            client.leagues.list(sport="football"),
            client.platform.health(),
        )


asyncio.run(main())
```

Mind the per-minute quota when you fan out, because a free key allows
100 requests a minute.

## Pagination

A `Page` behaves like the list it wraps.

```python
page = client.teams.list(league="epl", limit=20)
print(len(page), "of", page.total)  # 20 of 23

for team in page:
    print(team.name)

# Cross page boundaries. Always bound it, because some collections
# are huge. The player catalogue alone has 145,000 rows.
for team in client.teams.list(league="epl").auto_paging_iter(max_items=100):
    print(team.name)
```

## Errors

```python
from pitchside.errors import NotFoundError, PlanRequiredError, RateLimitError

try:
    odds = client.matches.odds(match_id, sport="football")
except PlanRequiredError as exc:
    print(exc.required_plan)  # 'edge'
    print(exc.upgrade_path.price)  # '$149/month'
    print(exc.upgrade_path.url)  # deep link to checkout
except RateLimitError as exc:
    if exc.is_circuit_breaker:
        # Too many 4xx responses. Fix the requests, because
        # upgrading will not help.
        print("cooldown:", exc.cooldown_seconds)
    else:
        print("quota, retry after", exc.retry_after)
except NotFoundError:
    ...
```

Everything derives from `PitchsideError`, so one `except` catches the
lot. On a `400`, `exc.field_errors` gives
`{"limit": ["Number must be less than or equal to 200"]}`, and
`exc.suggested_fix` is often the literal corrected request.

## Retries and timeouts

Retries are on by default, with three attempts, exponential backoff using
**full jitter**, and respect for `Retry-After`. Only idempotent requests
are replayed, so a `POST` is retried solely when it carries an
`Idempotency-Key`.

```python
from pitchside import Pitchside, RetryPolicy, Timeout

Pitchside(max_retries=5)
Pitchside(retry=RetryPolicy.disabled())
Pitchside(timeout=Timeout(connect=5, read=90))
```

**The default read timeout is 60 seconds, not 10.**
On the live service `/v1/teams/{id}` takes about 15s,
`/v1/mlb/leaders` about 26s and
`/v1/wc2026/matches/{id}/line-movement` about 30s, so a conventional 10s
timeout fails on healthy responses.

## Caching

Caching is on by default, with a TTL chosen per route from how fast that
route actually changes. The free tier allows 1,000 requests a day, and a
loop over a catalogue route can burn through that in minutes for no
reason, because the sport list changes about once a season.

| Route                                                      | TTL   | Why                                       |
| ---------------------------------------------------------- | ----- | ----------------------------------------- |
| `/v1/stored/*`                                           | 24h   | The archive is immutable once written     |
| `/v1/sports`, `/v1/leagues`                            | 24h   | Catalogue, changes about once a season    |
| `/v1/teams/{id}`, `/v1/teams`                          | 1h    | Reference data, and the 15 second route   |
| `/v1/players/{id}/career`, `/trophies`, `/transfers` | 1h    | A career does not move hourly             |
| `/v1/*/leaders`, `/injuries`, `top-scorers`          | 15min | Recomputed on a schedule                  |
| `/v1/standings`, `/v1/wc2026/groups`                   | 5min  | Recomputed on a schedule                  |
| `/v1/odds`, `/props`, `/line-movement`               | 15s   | Collapses a burst without holding a price |
| `/v1/matches*`, `/v1/games*`, `/health`, `/usage`  | never | Live state, always fetched                |
| anything unclassified                                      | 60s   | Short enough to be harmless               |

Every rule is configurable, and yours are consulted before the shipped
ones, so one override changes one route and leaves the rest alone.

```python
from pitchside import Pitchside, TTLCache

# Hold tables longer, keep teams for two hours, never cache leagues.
client = Pitchside(
    cache=TTLCache(
        ttls={
            "^/v1/standings$": 600,
            "^/v1/teams/": 7200,
            "^/v1/leagues": 0,
        }
    )
)

# Or cache a live route, which the shipped policy refuses to do for you.
client = Pitchside(cache=TTLCache(ttls={"^/v1/matches$": 30}))

# Ignore the shipped policy, or turn caching off entirely.
client = Pitchside(cache=TTLCache(ttls={...}, use_defaults=False))
client = Pitchside(cache=None)
```

Keys are the method, path and sorted query parameters. **The API key is
never part of a key.** Entries are deep-copied on the way out, so
mutating a result cannot corrupt the next reader, and only successful
`GET` responses are stored, so an error is never replayed for a TTL.

```python
client.cache.stats  # hits, misses, stores, evictions, hit_rate
client.cache.clear()  # drop everything, forcing the next call to refetch
```

The cache is per-process and per-client. Ten worker processes still make
ten cold calls, so implement `ResponseCache` over Redis if that matters.

### Inspecting the policy

The rules are ordered and the first match wins, which is why they are a
sequence rather than a mapping: position carries meaning. Both the table
and the decision are available at runtime.

```python
>>> from pitchside import DEFAULT_TTLS, Freshness, TTLPolicy
>>> len(DEFAULT_TTLS)
30
>>> TTLPolicy().explain("/v1/sports")
('^/v1/sports$', 86400.0)
>>> TTLPolicy().explain("/v1/matches")
('^/v1/matches(/[^/]+)?$', 0.0)
>>> TTLPolicy().explain("/v1/unknown-route")
(None, 60.0)
```

`explain` answers "why is this route not being cached", which a bare TTL
lookup cannot: a broad pattern placed early shadows a narrow one placed
later, and this shows which pattern actually decided.

Every TTL in the shipped table is a named tier rather than a bare number,
so the policy states its own reasoning:

```python
>>> list(Freshness)
[LIVE(0s), PRICES(15s), SIGNALS(60s), TABLES(300s), TOURNAMENT(600s),
 LEADERBOARDS(900s), ROSTERS(1800s), REFERENCE(3600s), ARCHIVE(86400s)]
>>> Freshness.ARCHIVE == 86400.0
True
```

Members subclass `float`, so they drop into your own rules unchanged:

```python
client = Pitchside(cache=TTLCache(ttls={"^/v1/standings$": Freshness.LIVE}))
```

## Rate limits

`X-RateLimit-*` is parsed off every response. Note that the API applies a
**per-route** budget on top of the account-wide one, so `/v1/sports`
reports a limit of 30 while most routes report 100. The snapshot
reflects the last route called.

```python
client.sports.list()
print(client.rate_limit.remaining, "left until", client.rate_limit.reset_at)

usage = client.platform.usage()
if usage.is_nearly_exhausted:
    ...
```

Watch `usage.recent[0].error_rate`, because a sustained 4xx rate trips
the gateway's circuit breaker and puts your key in cooldown.

## Provenance

Every payload carries a confidence score and a source tier, which is
unusual and worth using.

```python
envelope = client.get("/v1/matches", params={"sport": "football"})
print(envelope.meta.source)  # 'aggregator-free'
print(envelope.meta.confidence)  # 0.9
print(envelope.meta.is_stale)  # cached and older than a minute
```

## Escape hatch

Any route, wrapped or not:

```python
envelope = client.get("/v1/some/new/route", params={"x": 1})
print(envelope.data, envelope.raw)
```

Models keep unknown fields too, so a newly shipped API field is reachable
immediately:

```python
match.get("brand_new_field")
match.unknown_fields  # what the API sent that we do not model yet
```

## Webhooks

```python
hook = client.webhooks.create(
    url="https://example.com/hooks/pitchside",
    events=["score_update", "goal"],
    idempotency_key="setup-v1",  # replay-safe for 24h
)
# Returned ONCE. Store it now, because it cannot be read back.
print(hook.secret)
```

Deliveries are signed as `X-BBS-Signature: t=...,v1=...`, an HMAC-SHA256
over `t.body` with a five-minute window.

```python
from pitchside.webhooks import InvalidSignature, verify_signature


@app.post("/hooks/pitchside")
def hook():
    try:
        event = verify_signature(
            payload=request.get_data(),  # RAW BYTES, before parsing
            header=request.headers["X-BBS-Signature"],
            secret=os.environ["PITCHSIDE_WEBHOOK_SECRET"],
        )
    except InvalidSignature:
        return "", 400
    ...
```

Verify the raw bytes. Re-serialising the JSON changes whitespace and key
order, and the signature will not match.

## Live scores

```python
from pitchside.streaming import stream_match, stream_matches

for update in stream_match(client, match_id, interval=30):
    if update.score_changed:
        print(update.match.score)

# One request per poll for a whole slate, much cheaper than
# one stream per fixture.
for batch in stream_matches(client, sport="football", interval=30):
    for update in batch:
        print(update.match)
```

This polls. **The vendor's WebSocket does not work**, as covered in
[Known upstream issues](#known-upstream-issues).

---

## Logging

Standard library logging, with a `NullHandler` attached on import so
nothing is printed until you ask. Loggers follow the module layout, so a
subsystem can be turned up on its own:

| Logger | Covers |
|---|---|
| `pitchside` | Everything. Parent of the rest. |
| `pitchside._transport` | Request and response lines. |
| `pitchside.client` / `.aio` | Retries and cache decisions. |
| `pitchside.streaming` | Poll failures. |

For a REPL:

```python
import pitchside

pitchside.enable_logging()  # DEBUG, everything
pitchside.enable_logging(logger="pitchside._transport")
```

```
DEBUG   pitchside._transport   --> GET /v1/standings params={'league': 'epl'} attempt=1
DEBUG   pitchside._transport   <-- GET /v1/standings 200 in 211ms request_id=req_abc remaining=97
```

### Structured output and structlog

Every record carries the same facts as flat attributes, so a JSON or
structlog pipeline gets fields it can index while a plain stderr handler
stays readable. The attributes are ordinary record attributes, which is
what `structlog.stdlib.ExtraAdder` reads, so no adapter is needed:

```python
handler.setFormatter(
    structlog.stdlib.ProcessorFormatter(
        foreign_pre_chain=[
            structlog.stdlib.add_log_level,
            structlog.stdlib.add_logger_name,
            structlog.stdlib.ExtraAdder(),
        ],
        processor=structlog.processors.JSONRenderer(),
    )
)
logging.getLogger("pitchside").addHandler(handler)
```

```json
{"event": "<-- GET /v1/standings 200 in 211ms request_id=req_abc remaining=97",
 "level": "debug", "logger": "pitchside._transport", "method": "GET",
 "path": "/v1/standings", "status": 200, "elapsed_ms": 211,
 "request_id": "req_abc", "rate_limit": "100", "rate_remaining": "97"}
```

`pitchside.LOG_FIELDS` is the closed set of field names. A test asserts
none collide with a reserved `LogRecord` attribute, because such a
collision raises inside *your* logging call rather than ours.

**The API key never reaches a record.** Headers are not logged, and that
is the only place the key travels. A test asserts it appears in no
record, message or attribute. Messages are also ASCII-only, so a handler
writing to a cp1252 Windows console cannot raise on them.

## CLI

```bash
pip install "pitchside[cli]"

pitchside whoami
pitchside standings epl
pitchside matches --sport football --limit 5
pitchside scorers epl --category assists
pitchside wc groups
pitchside get /v1/nba/leaders --param stat=reb --param limit=3
```

Passing `--json` to any command emits raw JSON for `jq`.

---

## What is in the free tier

Verified against a live free key, **88 of 128 endpoint calls work**, 24
are plan-gated, and the rest are the bugs below.

**Free.** Every catalogue, fixture and standings route. World Cup 2026 in
full, including group tables, Elo predictions, Monte Carlo advancement
and live win probability. NBA, NHL and MLB leaderboards. **NBA and NHL
player props with the full sportsbook comparison.** NFL play-by-play with
EPA, injuries and depth charts. The historical store, reaching back to
the 1930 World Cup. Cricket, MMA and boxing.

**Solo, $19/mo.** Team form, rating history, head-to-head intelligence,
rolling player form, projections, streaks, tiers, predictions, value
props and trending.

**Edge, $149/mo.** All bookmaker odds, per-match statistics, NBA
play-by-play, ATS records, schedule context, historical odds, closing
lines and divergences.

`PlanRequiredError.required_plan` tells you which one at runtime.

---

## Known upstream issues

Found by exercising all 118 endpoints against the live API on 2026-08-28.
The route-by-route evidence is in
[docs/endpoint-audit.md](docs/endpoint-audit.md). Each issue is worked
around, documented on the affected method, and pinned by a test in
`tests/test_live.py::TestKnownUpstreamIssues` that **reports when the
vendor fixes it** so the workaround can be removed.

### Broken

| Route                               | Problem                                                                                                                                                                                                                                            |
| ----------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `GET /v1/teams/{id}/season`       | Returns`500` for every id tested. Wrapped for completeness, but it does not work.                                                                                                                                                                |
| `GET /v1/matches/{id}/events`     | Returns a**fixed demo payload** whose `match_id` is an unrelated `bb_match_*` id. Treat as illustrative.                                                                                                                                 |
| `GET /v1/players/{id}`            | Requires an undocumented`?sport=`, then times out. Use `client.players.profile()`.                                                                                                                                                             |
| `GET /v1/injuries`                | Requires`sport` or `team` despite the spec marking both optional, and often exceeds 30s. Use `client.nfl.injuries()`.                                                                                                                        |
| `wss://api.bigballsdata.com/live` | **Non-functional.** Every URL and auth style tested rejects the handshake with `400`, on both the production and Railway-fallback hosts. A plan gate would be `401` or `403`, so a `400` from the edge means no route is registered. |

### Inconsistent by design

- **Identifiers are not interchangeable.** `/v1/standings` returns
  `league_id` as a UUID, while `/v1/leagues/{id}` accepts only slugs such
  as `epl` and `404`s on that UUID. Within the NBA namespace,
  `/games/{id}` and `/plays` want a 10-digit id while `/matchup` and
  `/lineups` want the BBS UUID, and `/players/{id}/stats` wants a numeric
  NBA id that `/nba/leaders` never returns.
- **The OpenAPI spec is aspirational.** It documents
  `bb_<entity>_<base32>` canonical ids where the service returns UUIDs,
  `start_time` and `league_id` on matches where the service sends
  `kickoff_utc` and a league *name*, and required `meta` fields that the
  catalogue routes omit.
- **Webhook event names have three published spellings.** The spec says
  `match.score_update`, the docs page says `match_status_change`,
  `match_final` and `event_added`, and the server validator accepts
  `score_update`, `odds_move`, `lineup_confirmed`, `match_start`,
  `match_end`, `goal`, `card` and `substitution`. `WebhookEvent` follows
  the validator, which is the one that decides.
- **`/v1/teams/{id}/stats` never 404s.** An unknown id yields a
  zero-filled record with `200`, so check `.is_empty`.

### Slow

`/v1/teams/{id}` about 15s, `/v1/mlb/leaders` about 26s, and
`/v1/wc2026/matches/{id}/line-movement` about 30s. Hence the 60s default
read timeout.

---

## Development

```bash
uv sync --all-extras

uv run pytest                    # 351 tests, no network needed
uv run pytest --live -m live     # plus integration, needs a key
uv run ruff format . && uv run ruff check .
uv run ty check src/
```

The suite has three layers.

- **Unit.** Mocked transport via `respx`. Fixtures are captured from real
  responses, so they cannot drift into describing an envelope the
  service never sends.
- **Contract.** Invokes every method against a catch-all mock and checks
  the requested path against a vendored snapshot of the OpenAPI spec.
  This catches path typos across all 118 routes and fails if any route
  loses its wrapper. It also asserts that the sync and async twins have
  identical names and signatures.
- **Live.** Real API, opt-in, and deliberately frugal with quota.

## Layout

```
src/pitchside/
├── client.py / aio.py       sync and async clients
├── _transport.py            request building, retries, error mapping
├── envelope.py              the five response shapes, normalised
├── errors.py                exception hierarchy
├── config.py                settings, retry policy, rate-limit parsing
├── pagination.py            Page and AsyncPage
├── webhooks.py              signature verification
├── streaming.py             polling-based live scores
├── cli.py
├── models/                  response models, lenient by design
└── resources/               one module per namespace, sync and async
```

## Distribution

Released on PyPI as [`pitchside`](https://pypi.org/project/pitchside/).

There is no public source repository yet, so this README, the docstrings
and [docs/endpoint-audit.md](docs/endpoint-audit.md) are the documentation.
The sdist on PyPI carries the full test suite, so you can audit and run it
yourself:

```bash
pip download --no-binary :all: --no-deps pitchside
tar xf pitchside-0.1.0.tar.gz && cd pitchside-0.1.0
pip install -e ".[cli]" pytest respx pytest-asyncio
pytest                    # 415 tests, no network or credentials needed
```

### Pinning by hash

To stop a future release substituting itself, resolve the whole tree to
hashes once and install from that. Every requirement needs a hash for
this to work, which is why it goes through a compile step rather than a
bare `pip install`:

```bash
uv pip compile pyproject.toml --generate-hashes -o requirements.txt
uv pip install --require-hashes -r requirements.txt
```

### Releasing a new version

Bump `version` in `pyproject.toml`, add a `CHANGELOG.md` entry, then:

```bash
uv build
uvx twine check dist/*
uv publish                # reads UV_PUBLISH_TOKEN from the environment
```

Never reuse a version number. PyPI refuses to accept a version that has
been uploaded before, even if it was later deleted, so a botched release
is fixed by publishing `0.1.1`, not by replacing `0.1.0`.

## Security

Credential handling, webhook signature verification and the private
disclosure process are documented in [SECURITY.md](SECURITY.md). In
short, the key goes only to the gateway you configure, it is never
logged, and `verify_signature` compares digests in constant time.

## Legal

This library is MIT licensed. It is an independent client and is **not
affiliated with, endorsed by, or sponsored by Big Balls Sports Data**.
The name is used only to say which API this client speaks to.

**The licence covers this code, not the data.** Responses belong to the
vendor and its upstream providers and stay governed by the
[vendor terms](https://bigballsdata.com/legal/terms), whatever you do
with the client. Three of those terms bind you directly.

- **Do not resell the raw data feed.** Building a product on top is
  fine. Re-publishing the feed itself is not.
- **Do not share your API key.** It identifies your account for billing
  and abuse detection. Keep it in the environment, not in source
  control.
- **Do not bypass rate limits.** This client is built to cooperate,
  since it honours `Retry-After`, backs off with jitter, and never
  switches hosts to dodge a limit. `FALLBACK_BASE_URL` is exported for
  when the edge is degraded and is never selected automatically.

Some responses carry personal data about athletes, including dates of
birth, nationality and photographs. The library holds nothing on disk,
so anything you persist is yours to justify under GDPR or equivalent
law. The vendor publishes a [DPA](https://bigballsdata.com/legal/dpa).

The repository vendors one derived artefact from the vendor, a list of
route paths and methods in `tests/data/openapi_paths.json`, used to
detect path typos. It records its source and capture date, holds no
schemas or prose, and comes from `/openapi.json`, which the vendor's
`robots.txt` explicitly allows.

A licence audit of the full dependency closure is in
[docs/licences.md](docs/licences.md). Every entry is permissive;
there is no GPL, LGPL, AGPL or SSPL anywhere in the tree.
