2026-06-26 08:13:33 -04:00
|
|
|
# Garmin Data Fetcher
|
2026-05-08 11:35:10 -04:00
|
|
|
|
2026-06-26 08:13:33 -04:00
|
|
|
A Python script to download per-second activity data (heart rate, GPS, cadence, etc.) from Garmin Connect and extract it from FIT files for analysis.
|
2026-05-08 11:35:10 -04:00
|
|
|
|
|
|
|
|
## Setup
|
|
|
|
|
|
2026-06-26 08:13:33 -04:00
|
|
|
1. Create virtual environment:
|
|
|
|
|
```bash
|
|
|
|
|
python -m venv venv
|
|
|
|
|
source venv/bin/activate
|
2026-05-08 11:35:10 -04:00
|
|
|
```
|
|
|
|
|
|
2026-06-26 08:13:33 -04:00
|
|
|
2. Install dependencies:
|
|
|
|
|
```bash
|
|
|
|
|
pip install garminconnect garmin_fit_sdk
|
2026-05-08 11:35:10 -04:00
|
|
|
```
|
|
|
|
|
|
2026-06-26 08:13:33 -04:00
|
|
|
3. Set environment variables:
|
|
|
|
|
```bash
|
|
|
|
|
export GARMIN_EMAIL=your_email@example.com
|
|
|
|
|
export GARMIN_PASSWORD=your_password
|
2026-05-08 11:35:10 -04:00
|
|
|
```
|
|
|
|
|
|
2026-06-26 08:13:33 -04:00
|
|
|
## Usage
|
2026-05-10 21:14:43 -04:00
|
|
|
|
2026-06-26 08:13:33 -04:00
|
|
|
Run the script to download and extract data:
|
|
|
|
|
```bash
|
|
|
|
|
python scripts/fetch_garmin_data.py
|
2026-05-10 21:14:43 -04:00
|
|
|
```
|
|
|
|
|
|
2026-06-26 08:13:33 -04:00
|
|
|
The script will:
|
|
|
|
|
- Authenticate with Garmin Connect
|
|
|
|
|
- Download the most recent activity's FIT file
|
|
|
|
|
- Extract per-second record data (heart rate, GPS, cadence, etc.)
|
|
|
|
|
- Save the data as JSON for analysis
|
2026-05-08 11:35:10 -04:00
|
|
|
|
2026-06-26 08:13:33 -04:00
|
|
|
## Output
|
2026-05-08 11:35:10 -04:00
|
|
|
|
2026-06-26 08:13:33 -04:00
|
|
|
Data is saved in `garmin_data/` as:
|
|
|
|
|
- `{activity_id}.fit` - Original FIT file
|
|
|
|
|
- `{activity_id}_data.json` - Extracted per-second records
|