{"id":15019167,"url":"https://github.com/frc1418/tbapy","last_synced_at":"2025-10-24T05:31:23.928Z","repository":{"id":17325213,"uuid":"81682908","full_name":"frc1418/tbapy","owner":"frc1418","description":":chart_with_upwards_trend: Python wrapper for The Blue Alliance API.","archived":false,"fork":false,"pushed_at":"2023-02-01T22:59:03.000Z","size":85,"stargazers_count":51,"open_issues_count":2,"forks_count":16,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-01-31T00:06:56.315Z","etag":null,"topics":["frc","tba-api","the-blue-alliance"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/frc1418.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-11T21:16:33.000Z","updated_at":"2024-12-21T03:02:10.000Z","dependencies_parsed_at":"2023-02-17T12:01:02.377Z","dependency_job_id":null,"html_url":"https://github.com/frc1418/tbapy","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frc1418%2Ftbapy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frc1418%2Ftbapy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frc1418%2Ftbapy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frc1418%2Ftbapy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/frc1418","download_url":"https://codeload.github.com/frc1418/tbapy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237918710,"owners_count":19387305,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["frc","tba-api","the-blue-alliance"],"created_at":"2024-09-24T19:53:05.915Z","updated_at":"2025-10-24T05:31:23.919Z","avatar_url":"https://github.com/frc1418.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tbapy [![PyPI version](https://badge.fury.io/py/tbapy.svg)](https://badge.fury.io/py/tbapy)\n_1418 TBA Libraries_ // [**Python**](https://github.com/frc1418/tbapy) // [Go](https://github.com/frc1418/tbago) // [Ruby](https://github.com/frc1418/tbarb)\n\n\u003e Python library for interfacing with [The Blue Alliance](https://thebluealliance.com) [API](https://thebluealliance.com/apidocs) (v3).\n\n## Setup\nFirst, install the module:\n\n    pip3 install tbapy\n\nThen, to use these functions, you must import the `tbapy` module:\n\n```py\nimport tbapy\n```\n\nBefore using the library, you must instantiate its class, for example:\n\n```py\ntba = tbapy.TBA('key')\n```\n\nThe Blue Alliance's API requires that all applications identify themselves with an auth key when retrieving data. To obtain an auth key, visit TBA's [Account page](https://www.thebluealliance.com/account).\n\n\n## Retrieval Functions\nYou may specify `simple=True` to get only vital data on some models or lists of models, or you may specify `keys=True` to get a list of the keys for a list rather than full data on each model. It is recommended to use these options if you do not need full data.\n\nSome requests support `year` and other optional parameters, which are recommended to use to narrow down your results.\n* `tba.status()` - Get TBA's status.\n* `tba.teams([page], [year], [simple/keys])` - Get a list of of valid teams, where `page * 500` is the starting team number. If no page is provided, all teams will be fetched.\n* `tba.team(team, [simple])` - Get a team's data. `team` can be an integer team number of a string-form `'frc####'` identifier.\n* `tba.team_events(team, [year], [simple/keys])` - Get a list of events a team has been to.\n* `tba.team_awards(team, [event/year])` - Get a list of the team's awards.\n* `tba.team_matches(team, [event/year], [simple/keys])` - Get a list of a team's matches at an event.\n* `tba.team_years(team)` - Get a list of years the team was active in FRC.\n* `tba.team_media(team, [year], [tag])` - Get team media. Specify a year to get media from or a tag or both.\n* `tba.team_robots(team)` - Get data about a team's robots.\n* `tba.team_districts(team)` - Get the districts that a team has been part of over the years.\n* `tba.team_profiles(team)` - Get data on a team's media profiles.\n* `tba.team_status(team, event)` - Get a team's status at an event.\n* `tba.events([year], [simple/keys])` - Get a list of all events.\n* `tba.event(event, [simple])` - Get data about an event.\n* `tba.event_rankings(event)` - Gets a list of team rankings at a given event.\n* `tba.event_alliances(event)` - Get sophisticated data on alliances at a given event.\n* `tba.event_district_points(event)` - Get sophisticated data on district points at a given event.\n* `tba.event_insights(event)` - Get insight data on a given event.\n* `tba.event_oprs(event)` - Get sophisticated data on alliances at a given event.\n* `tba.event_predictions(event)` - Get predicted scores for a given event.\n* `tba.event_teams(event, [simple/keys])` - Get a list of teams at an event.\n* `tba.event_awards(event)` - Get the awards from an event.\n* `tba.event_matches(event, [simple/keys])` - Get a match list of an event.\n* `tba.match([key], [year], [event], [type], [number], [round], [simple])` - Get data about a match. You may either pass the match's `key` directly, or pass `year`, `event`, `type`, `match` (the match number), and `round` if applicable (playoffs only). The event year may be specified as part of the event key or specified in the `year` parameter.\n* `tba.districts(year)` - Get a list of all districts that exist(ed) in a given year.\n* `tba.district_events(district, [simple/keys])` - Get list of events in a district.\n* `tba.district_rankings(district)` - Get the rankings in a district.\n* `tba.district_teams(district, [simple/keys])` - Get a list of the teams in a district.\n* `tba.district_history(abbreviation)` - Get a list of districts associated with the given abbreviation (e.g. `'fim'`).\n* `tba.district_awards(district)` - Get a list of awards in a district.\n* `tba.insights_leaderboards(year)` - Get a list of leaderboard insights in the given year. Use year=0 for overall.\n* `tba.insights_notables(year)` - Get a list of notable insights in the given year. Use year=0 for overall.\n\n\nSee `example.py` for several usage examples.\n\nDocumentation for The Blue Alliance's API can be found [here](https://www.thebluealliance.com/apidocs).\n\n## Write Functions\nWriting to The Blue Alliance requires an additional set of tokens that can be obtained [here](https://www.thebluealliance.com/request/apiwrite).\n\nSince each set of tokens is unique to an event you will have the instantiate the TBA class like so:\n```\ntba = tbapy.TBA('key', 'ID', 'secret', 'event_key')\n```\nor update an existing TBA object like so:\n```\ntba.update_trusted('ID', 'secret', 'event_key')\n```\nAll of the write functions require data models that can be found [here at the Write API documentation](https://www.thebluealliance.com/apidocs/trusted/v1)\n* `tba.update_event_info(info)` - Update the Event's info with the given dictionary.\n* `tba.update_event_alliances(alliances)` - Update the alliances. Input is a list of lists, 8 lists with the team names in frc#### format are expected.\n* `tba.update_event_awards(awards)` - Update the awards for an event with a list of dictionaries. Each dictionary must have a name_str key and optionally a team_key key in frc### format and/or an awardee key for an individual award.\n* `tba.update_event_matches(rankings)` - Update the matches of an event with a dictionary. Additional info can be found in the Write API Documentation on The Blue Alliance.\n* `tba.delete_event_matches([matches])` - Delete all matches or the matches in the given list.\n* `tba.update_event_rankings(rankings)` - Update rankings of an event with a dictionary containing a breakdowns key and rankings key. Rankings key must have a list of dictionaries as the value.\n* `tba.update_event_team_list(team_list)` - Replace the event's team list with the list given.\n* `tba.add_match_videos(match_videos)` - Add YouTube videos to matches with a dictionary of partial match keys to YouTube video ids.\n* `tba.add_event_videos(event_videos)` - Add videos to the event's media tab on The Blue Alliance with a list of YouTube video ids.\n\n## Authors\nThis software was created and is maintained by [Erik Boesen](https://github.com/ErikBoesen) with [Team 1418](https://github.com/frc1418). Additional contributions made by [Ian Weiss](https://github.com/endreman0) with [Team 4131](https://github.com/FRC4131).\n\n## License\nThis software is protected under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrc1418%2Ftbapy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrc1418%2Ftbapy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrc1418%2Ftbapy/lists"}