Python client for The Blue Alliance API v3 — typed, schema-validated, zero boilerplate.
Project description
BlueAlliancePy
Python client for The Blue Alliance API v3. Typed, schema-validated, zero boilerplate.
Built for FRC Team 7563 (Megazord) scouting infrastructure.
Installation
pip install bluealliance
Or directly from the repository:
pip install git+https://github.com/Kaique-Sique/BlueAlliancePy.git
Quick start
Get your API key at https://www.thebluealliance.com/account.
from bluealliance import TBACollector
c = TBACollector("YOUR_TBA_KEY")
# team profile
team = c.team("frc7563")
print(team.nickname, team.city) # Megazord, Jundiaí
# all teams at an event (typed, not raw dicts)
for team in c.event_teams("2025spbra"):
print(team.team_number, team.nickname)
# live rankings
ranking = c.event_rankings("2025spbra")
if ranking:
for entry in ranking.rankings[:5]:
print(entry.rank, entry.team_key, entry.record)
# full event bundle in one call
bundle = c.event_bundle("2025spbra")
print(bundle.event.name)
print(f"{len(bundle.teams)} teams, {len(bundle.matches)} matches")
# 2025 Reefscape score breakdown already parsed
for match, bd in c.event_matches_2025("2025spbra"):
if bd:
coral = bd.red.autoCoralCount + bd.red.teleopCoralCount
print(match.key, "red coral:", coral, "endgame:", bd.red.endGameRobot1)
Three layers
| Layer | Import | What it does |
|---|---|---|
TBAClient |
from bluealliance import TBAClient |
Raw HTTP — returns dict/list. One method per TBA endpoint (84 total). |
TBACollector |
from bluealliance import TBACollector |
Typed — wraps every client method to return Pydantic models instead of dicts. Handles pagination automatically. |
| Schemas | from bluealliance import Team, Match, Event |
Pydantic v2 models. Use Model.model_validate(raw) if you already have a dict. |
You can mix layers freely — TBACollector for most work, TBAClient when you need the raw payload for something not covered by the schemas.
Low-level client
from bluealliance import TBAClient
client = TBAClient("YOUR_TBA_KEY")
# returns raw dict/list -- no Pydantic parsing
raw = client.get_event_matches("2025spbra")
raw_team = client.get_team("frc7563")
Pydantic models directly
from bluealliance.schemas import Team, Match, ScoreBreakdown2025, parse_score_breakdown_2025
team = Team.model_validate(raw_dict)
match = Match.model_validate(raw_match_dict)
bd = parse_score_breakdown_2025(match.score_breakdown)
if bd:
print(bd.red.totalPoints, bd.blue.endGameBargePoints)
Available collector methods
Status
c.status()→APIStatus
Teams
c.team(key)→Teamc.team_simple(key)→TeamSimplec.team_history(key)→TeamHistoryc.team_robots(key)→list[TeamRobot]c.team_awards(key, year?)→list[Award]c.team_media(key, year)→list[MediaBase]c.team_events(key, year?)→list[Event]c.team_matches(key, year)→list[Match]c.team_event_matches(key, event_key)→list[Match]c.team_event_status(key, event_key)→TeamEventStatus | Nonec.team_season_summary(key, year)→TeamSeasonSummaryc.all_teams_by_year(year)→list[Team](auto-paginates)
Events
c.events(year)→list[Event]c.event(key)→Eventc.event_teams(key)→list[Team]c.event_matches(key)→list[Match]c.event_matches_2025(key)→list[tuple[Match, ScoreBreakdown2025 | None]]c.event_rankings(key)→EventRanking | Nonec.event_oprs(key)→EventOPRs | Nonec.event_alliances(key)→list[EliminationAlliance] | Nonec.event_awards(key)→list[Award]c.event_teams_statuses(key)→dict[str, TeamEventStatus | None]c.event_bundle(key)→EventBundle
Matches
c.match(key)→Matchc.match_2025(key)→tuple[Match, ScoreBreakdown2025 | None]c.match_zebra(key)→Zebra
Districts
c.districts(year)→list[District]c.district_rankings(key)→list[DistrictRanking] | Nonec.district_advancement(key)→dict[str, DistrictAdvancement] | None
Regional (2025+)
c.regional_advancement(year)→dict[str, RegionalAdvancement] | Nonec.regional_rankings(year)→list[RegionalRanking] | None
Insights
c.leaderboards(year)→list[LeaderboardInsight]c.insights_v2(year, category?)→list[InsightV2...]
Requirements
- Python 3.11+
requests >= 2.32pydantic >= 2.7
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 bluealliance-0.1.0.tar.gz.
File metadata
- Download URL: bluealliance-0.1.0.tar.gz
- Upload date:
- Size: 18.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b4aa6e9ac60918b6f0f586def37b70d1c28cbad1cc8f6ecf7dd290704fb4a88
|
|
| MD5 |
085ff3ba0138590a8a1116d2981b85ed
|
|
| BLAKE2b-256 |
01213438f1e189e59fb8995ad334ded82b5f01469f1264566c5657d995dd7592
|
File details
Details for the file bluealliance-0.1.0-py3-none-any.whl.
File metadata
- Download URL: bluealliance-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef222c3f93e5d5a85e2cb5435dceb63b7dae5a2488e569d965e2217ccc9c9aac
|
|
| MD5 |
46484b1b058159f6fa179ac90d879ae1
|
|
| BLAKE2b-256 |
94fe359b30b53be8724d1acf6e56a5de27a4df3f8d2fd341be501f61666c28ae
|