This tool is designed to fetch and process data from The Blue Alliance (TBA) API. It retrieves teams' information alongside their awards and generates a CSV file and a JSON file with detailed summaries.
- Python: The script requires Python 3 is installed on your machine.
Follow these steps to prepare and run the script:
-
Clone the repository if you haven't already:
git clone <your-repository-url> cd <your-repository-directory>
-
Run the setup script to create and activate the virtual environment and install dependencies:
source setup.bash -
Ensure the
.envfile with theTBA_API_KEYis in the same directory as the script. You can usetemplate.envas a template. Rename it to.env:TBA_API_KEY=<Your_TBA_API_Key>
To execute the script and fetch the award information:
-
Run the Python script:
python tba_awards_scraper.py
-
After execution, the results will be saved as:
frc_team_awards.json: A JSON file containing teams and their awards, including detailed award information such as award names, types, years, and event keys.tba_api_cache.json: A cache file to store API responses and reduce unnecessary API calls.
Upon successful execution, the script will:
- Fetch all the teams and their awards from The Blue Alliance API
- Save the detailed results in JSON format
- Display progress information during execution
- Cache API responses to improve performance and respect rate limits
- Ensure your API key (
TBA_API_KEY) is valid and you're authorized to access The Blue Alliance API. - The script incorporates a delay (
time.sleep()) to manage rate limits effectively.