Registry / http-networking / garminconnect

garminconnect

JSON →
library0.3.6pypypiunverified

garminconnect is a Python 3 API wrapper for Garmin Connect, enabling programmatic access to a user's health metrics, activity data, workouts, and other fitness information. The library is actively maintained, with frequent updates (current version 0.3.2) to adapt to changes in Garmin's API infrastructure, particularly authentication and Cloudflare bypass mechanisms.

pip install garminconnect curl_cffi ua-generator
INSTALL
IMPORT
SIG · GARMINCONNECT
G
garminconnect
http-networkingpythonv0.3.6
Install
4.2s avg
Import
908ms
Disk
65MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.3.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.940 runs
installs and imports cleanly · install 0.0s · import 0.955s · 69.1MB
glibc
py 3.103.940 runs
installs and imports cleanly · install 4.2s · import 0.862s · 66MB
65MB installed
● package 65MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Garmin
from garminconnect import Garmin

This quickstart demonstrates how to log in to Garmin Connect and retrieve activity data for the current day. It emphasizes using environment variables for sensitive credentials. The library handles token saving and refreshing automatically after the initial login. Make sure to set `GARMIN_USERNAME` and `GARMIN_PASSWORD` in your environment.

import os import datetime from garminconnect import Garmin # Get credentials from environment variables for security USERNAME = os.environ.get('GARMIN_USERNAME', '') PASSWORD = os.environ.get('GARMIN_PASSWORD', '') if not USERNAME or not PASSWORD: print("Please set GARMIN_USERNAME and GARMIN_PASSWORD environment variables.") exit(1) api = None try: # Initialize Garmin API with credentials # Tokens are automatically saved to ~/.garminconnect/garmin_tokens.json api = Garmin(USERNAME, PASSWORD) api.login() print("Successfully logged in to Garmin Connect.") # Example: Get today's activity data today = datetime.date.today() activities = api.get_activities_by_date(today.isoformat(), today.isoformat()) if activities: print(f"Activities for {today.isoformat()}:") for activity in activities: print(f" - {activity['activityType']['typeKey']}: {activity['distance']}m, {activity['duration']}s") else: print(f"No activities found for {today.isoformat()}.") except Exception as e: print(f"An error occurred: {e}")
Debug
Known issues
breakingVersion 0.3.0 introduced a complete rewrite of the authentication engine, replacing the `garth` dependency with a native SSO flow that mimics the official Garmin Connect app. This change ensures better reliability against Garmin's evolving API and Cloudflare protections.
fix
Saved tokens from versions prior to 0.3.0 are incompatible. A fresh login (`api.login()`) is required after upgrading. Additionally, install the new mandatory dependencies: `curl_cffi` and `ua-generator`.
affects: >=0.3.0
gotchaGarmin Connect uses Cloudflare, which can aggressively block programmatic access based on perceived bot activity, IP address reputation, or rate limits, potentially leading to '429 Too Many Requests' or 'Access denied' errors.
fix
The library (v0.3.0+) implements TLS impersonation strategies and random browser fingerprinting (via `curl_cffi` and `ua-generator`) to mitigate Cloudflare blocking. Ensure these dependencies are installed. If issues persist, reduce API call frequency or try initiating login from a different network/IP. Persistent blocks might require contacting Garmin support.
affects: All versions
gotchaMulti-Factor Authentication (MFA) can interrupt the login flow. While the library supports MFA, it requires interaction (a callback function) or providing the MFA code via an environment variable.
fix
For interactive use, the `login()` method will prompt for an MFA code if required. For automated scripts, you can provide the MFA code using the `GARMIN_MFA_CODE` environment variable for the `prompt_mfa` callback, or implement a custom `prompt_mfa` handler in the `Garmin` constructor.
affects: All versions
Upgrade
Version history
0.3.6latest on PyPI · released Jun 14, 2026
Audit
Dependencies
curl_cffirequiredRequired for Cloudflare bypass and TLS impersonation strategies introduced in v0.3.0 to robustly handle Garmin's security measures.
ua-generatorrequiredRequired for random browser fingerprinting, introduced in v0.3.0, to improve authentication success rates and mimic legitimate browser traffic.
Agent activity
9 hits · last 30 days
node
6
Amazon
1
Resources
garminconnect — pip install garminconnect · libregistry