Skip to content

Release 0.3.21

Latest

Choose a tag to compare

@cyberjunky cyberjunky released this 28 Nov 15:19

What's Changed

This release adds dog profiles, sleep-window editing, the primary wearable setting and activity photo uploads. It also fixes login() reporting network and server errors as rejected tokens, which with saved tokens and credentials could throw away working tokens and force a full login.

Added

  • Dog profiles: read, create, edit, retire or re-activate and delete the dogs on your account, upload a dog's photo, read dog activity stats, and link dogs to an activity. Tested live; the China host (gcx.garmin.cn) is untested. Thanks @ttlopes! (#485)
    • Reads: get_dogs(), get_dog(), get_dog_breeds(), get_dog_lifetime_stats(), get_dog_stats(), get_dog_activities_enabled()
    • Writes: create_dog(), update_dog(), set_dog_status(), delete_dog(), upload_dog_photo(), set_activity_dogs(activity_id, dog_ids) ([] removes all dogs)
    • Weight is always in grams, whatever the account's unit setting.
  • Correct a night's sleep: set_sleep_window(cdate, sleep_start, sleep_end) changes when the sleep recorded for a day began and ended, like the web app's "Edit sleep" dialog. Garmin then recalculates sleep time and stages. Start and end must be timezone-aware datetimes. Times that don't exist or are ambiguous around a daylight-saving change are rejected instead of being saved wrong. Thanks @christianhaberl! (#484)
  • Choose the primary wearable: set_primary_activity_tracker(device_id) sets the device Garmin uses for steps, stress and sleep (the web app's "Primary Wearable"). This is separate from set_primary_training_device(), which only moves the training role. Thanks @christianhaberl! (#483)
  • Add and remove activity photos: upload_activity_image(activity_id, image_path) adds a JPEG or PNG and returns its imageId; delete_activity_image(activity_id, image_id) removes one. Until now photos could only be read with get_activity_images(). Thanks @pvonkaenel! (#482)

All new methods are in demo.py, including a new "Dogs" category.

Fixed

  • Network and server errors while loading the profile are no longer reported as authentication errors: an SSL error, timeout, DNS failure or Garmin 5xx made login() raise GarminConnectAuthenticationError, so callers couldn't tell "retry later" from "log in again". With a token store plus username and password, the stale-token fallback then discarded working tokens and ran a full credential login, with possible MFA prompts and rate limits. Now only a 401/403 or invalid profile data is an authentication error; a 429 raises GarminConnectTooManyRequestsError and other failures raise GarminConnectConnectionError. Thanks @Jet1i for the report and analysis! (#486, #487)

Development

  • Releases are published to PyPI by GitHub Actions with trusted publishing: no PyPI token is stored anymore, and the manual pdm run publish script is removed. This is the first release published this way. (#488)

Full Changelog: 0.3.20...0.3.21