Official Python SDK for the Magisterial college sports data API
Project description
Magisterial Python SDK
The official Python library for the Magisterial developer API — college sports data across NCAA D1/D2/D3, NAIA, and NJCAA: players, teams, rosters, cross-program careers, games, the live transfer portal, and an agent-backed natural-language query endpoint.
- Interactive API reference: https://api.magisterial.ai/v1/docs
- OpenAPI spec: https://api.magisterial.ai/v1/openapi.json
- Agent-ready one-file reference: https://api.magisterial.ai/v1/llms.txt
Installation
pip install magisterial
Requires Python 3.10+.
Usage
Create an API key at magisterial.ai/console/api-keys
and set MAGISTERIAL_API_KEY (or pass api_key= to the client).
from magisterial import Magisterial
client = Magisterial()
# Search players (auto-pagination follows the cursor for you)
page = client.players.search(
sport="soccer", division="D1", gender="women",
position="Forward", sort_by="goals",
)
for player in page.auto_paging_iter():
print(player.name, player.team, player.stats.get("goals"))
# One player's full profile
player = client.players.get(184223, sport="soccer", division="D3")
# Live transfer portal (usage-billed; use `since` for incremental polling)
portal = client.portal.list(sport="basketball", division="D1", status="INC")
# Natural-language query (usage-billed): submit and wait for the answer
run = client.query.create_and_poll(
prompt="Who led the NESCAC in assists this season?",
sport="soccer", division="D3", gender="men",
)
print(run.answer)
Async
Every method is mirrored on AsyncMagisterial:
import asyncio
from magisterial import AsyncMagisterial
async def main():
async with AsyncMagisterial() as client:
page = await client.players.search(sport="soccer", division="D1")
async for player in page.auto_paging_iter():
print(player.name)
asyncio.run(main())
Errors
Non-2xx responses raise typed exceptions carrying the API's error envelope:
from magisterial import Magisterial, NotFoundError, RateLimitError
client = Magisterial()
try:
client.players.get(1, sport="soccer", division="D1")
except NotFoundError as e:
print(e.error_code) # "player_not_found"
except RateLimitError as e:
print(e.retry_after) # seconds, from the Retry-After header
BillingError (402) means API billing is not enabled or the monthly budget is
exhausted — manage both in the developer console.
Retries
Idempotent requests (and players.search) are retried automatically on 429s,
5xx and connection failures — up to max_retries (default 2), honoring the
server's Retry-After. Billable creates (query.create, alerts.create)
are never retried automatically.
Types
All request/response models live in magisterial.types and are generated from
the published OpenAPI spec (scripts/sync-types.sh), so they cannot drift
from the live API contract.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file magisterial-0.1.0.tar.gz.
File metadata
- Download URL: magisterial-0.1.0.tar.gz
- Upload date:
- Size: 30.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
260339c1b5882a8e8e287179cb7c671b91cdc225770c4714da88e8946d37d775
|
|
| MD5 |
cf28e3a01ca9a62a3fe9eb98da378420
|
|
| BLAKE2b-256 |
dc02e37526ec8466218c40500cb94f9e73ee5450cf48fa82404b475333efa7b1
|
Provenance
The following attestation bundles were made for magisterial-0.1.0.tar.gz:
Publisher:
publish.yml on bluemens/magisterial-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
magisterial-0.1.0.tar.gz -
Subject digest:
260339c1b5882a8e8e287179cb7c671b91cdc225770c4714da88e8946d37d775 - Sigstore transparency entry: 2211934803
- Sigstore integration time:
-
Permalink:
bluemens/magisterial-python@4a0afd75c240fd56f3b83a17a44c13f93d08c584 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/bluemens
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4a0afd75c240fd56f3b83a17a44c13f93d08c584 -
Trigger Event:
release
-
Statement type:
File details
Details for the file magisterial-0.1.0-py3-none-any.whl.
File metadata
- Download URL: magisterial-0.1.0-py3-none-any.whl
- Upload date:
- Size: 21.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3de0438e6e24d82600687f64489ed5146a5a7f6da006f96d4d45475a24999c93
|
|
| MD5 |
89e825e95101750e4e71aa0e2df1bfc6
|
|
| BLAKE2b-256 |
541cdc7482486f10c93ac3890a0e316d2cad81ea2766a806a61064a8414e5791
|
Provenance
The following attestation bundles were made for magisterial-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on bluemens/magisterial-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
magisterial-0.1.0-py3-none-any.whl -
Subject digest:
3de0438e6e24d82600687f64489ed5146a5a7f6da006f96d4d45475a24999c93 - Sigstore transparency entry: 2211934820
- Sigstore integration time:
-
Permalink:
bluemens/magisterial-python@4a0afd75c240fd56f3b83a17a44c13f93d08c584 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/bluemens
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4a0afd75c240fd56f3b83a17a44c13f93d08c584 -
Trigger Event:
release
-
Statement type: