Skip to content

Commit 69ade42

Browse files
committed
Updates intervals.icu to allow local api key
1 parent 7c7cb15 commit 69ade42

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ RIDEWITHGPS_KEY=your_api_key
6161
# Garmin Connect
6262
GARMIN_EMAIL=your_email
6363
GARMINTOKENS=~/.garminconnect
64+
65+
# Intervals.icu (https://intervals.icu/settings)
66+
INTERVALSICU_API_KEY=your_api_key
6467
```
6568

6669
### Authenticating with Strava

TODO.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ next:
1111
- [ ] bug: intervals.icu gear update not working (make sure gear exists)
1212
- [ ] bug: strava gear update sometimes not workign due to running shoe naming
1313
- [ ] feat: as syncs are applied, update the visible table on /month/YYYY-MM to show as it updates
14-
- [ ] feat: tracekit support api usage for local
1514
- [ ] for web app, require subscription to be active for providers to sync
1615
- [ ] refactor all the web/sync stuff to use list of providers from code/admin, not hardcoded individually
1716
- [ ] discord?
@@ -36,7 +35,6 @@ later
3635
- [ ] Ensure no API calls are made if the month is already synced
3736
- [ ] Fix Strava gear matching to work for running shoes
3837
- [ ] Fix "create" in providers to `create_from_activity`, get all that out of `sync_month` command
39-
- [ ] Add intevals.icu as provider
4038
- [ ] Add TrainingPeaks as provider
4139
- [ ] Add Wandrer.earth as provider
4240
- [ ] What about choochoo?

tracekit/providers/intervalsicu/intervalsicu_provider.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Intervals.icu provider for tracekit."""
22

3+
import base64
34
import datetime
45
import json
56
import os
@@ -29,10 +30,14 @@ def __init__(self, config: dict[str, Any] | None = None):
2930
os.environ.get("INTERVALSICU_CLIENT_SECRET", "").strip() or cfg.get("client_secret", "").strip()
3031
)
3132
self.access_token = cfg.get("access_token", "").strip()
33+
self.api_key = os.environ.get("INTERVALSICU_API_KEY", "").strip() or cfg.get("api_key", "").strip()
3234
# athlete_id from config; "0" is the API shortcut for the current user
3335
self.athlete_id = cfg.get("athlete_id", "0").strip() or "0"
3436

3537
def _auth_headers(self) -> dict[str, str]:
38+
if self.api_key:
39+
token = base64.b64encode(f"API_KEY:{self.api_key}".encode()).decode()
40+
return {"Authorization": f"Basic {token}"}
3641
return {"Authorization": f"Bearer {self.access_token}"}
3742

3843
def _get(self, path: str, **kwargs) -> Any:

0 commit comments

Comments
 (0)