What's Changed
Features
-
Typed response layer (
g.typedaccessor) — an optional Pydantic namespace that wraps high-value read endpoints with validated, IDE-friendly models. Requirespydantic>=2.0; zero impact on existing users.pip install garminconnect[typed]
g = Garmin(email, password) raw = g.get_stats(date) # dict[str, Any] — unchanged stats = g.typed.get_stats(date) # DailyStats (Pydantic model) print(stats.total_steps, stats.resting_heart_rate)
Supported methods in this release:
Method Typed return get_stats,get_user_summaryDailyStatsget_sleep_dataSleepDataget_hrv_dataHrvData | Noneget_body_batterylist[BodyBatteryEntry]get_training_readinesslist[TrainingReadiness]get_activities_by_datelist[Activity]Validation failures raise
GarminConnectResponseValidationErrorwith.rawpreserved. Extra/missing fields are tolerated so schema drift doesn't break running apps. Marked experimental — the surface may evolve based on feedback.
Bug Fixes
- CN account token refresh — DI OAuth2 token endpoint now routes to
diauth.garmin.cnforis_cn=Trueaccounts. Previously the.comendpoint was always used, causing refresh failures (invalid_grant) after the ~4-hour access token TTL expired. Cron-driven sync jobs and long-running sessions on CN accounts are now fixed. (PR #360 by @MidnightV1)
Contributors
- @sorlen008 — typed namespace implementation
- @MidnightV1 — CN DI token endpoint fix
Full Changelog: v0.3.3...v0.3.4