garminconnect


Namegarminconnect JSON
Version 0.2.14 PyPI version JSON
download
home_page
SummaryPython 3 API wrapper for Garmin Connect
upload_time2024-03-15 14:30:28
maintainer
docs_urlNone
author
requires_python>=3.10
licenseMIT
keywords garmin connect api garmin
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python: Garmin Connect

```
$ ./example.py
*** Garmin Connect API Demo by cyberjunky ***

1 -- Get full name
2 -- Get unit system
3 -- Get activity data for '2024-03-15'
4 -- Get activity data for '2024-03-15' (compatible with garminconnect-ha)
5 -- Get body composition data for '2024-03-15' (compatible with garminconnect-ha)
6 -- Get body composition data for from '2024-03-08' to '2024-03-15' (to be compatible with garminconnect-ha)
7 -- Get stats and body composition data for '2024-03-15'
8 -- Get steps data for '2024-03-15'
9 -- Get heart rate data for '2024-03-15'
0 -- Get training readiness data for '2024-03-15'
- -- Get daily step data for '2024-03-08' to '2024-03-15'
/ -- Get body battery data for '2024-03-08' to '2024-03-15'
! -- Get floors data for '2024-03-08'
? -- Get blood pressure data for '2024-03-08' to '2024-03-15'
. -- Get training status data for '2024-03-15'
a -- Get resting heart rate data for 2024-03-15'
b -- Get hydration data for '2024-03-15'
c -- Get sleep data for '2024-03-15'
d -- Get stress data for '2024-03-15'
e -- Get respiration data for '2024-03-15'
f -- Get SpO2 data for '2024-03-15'
g -- Get max metric data (like vo2MaxValue and fitnessAge) for '2024-03-15'
h -- Get personal record for user
i -- Get earned badges for user
j -- Get adhoc challenges data from start '0' and limit '100'
k -- Get available badge challenges data from '1' and limit '100'
l -- Get badge challenges data from '1' and limit '100'
m -- Get non completed badge challenges data from '1' and limit '100'
n -- Get activities data from start '0' and limit '100'
o -- Get last activity
p -- Download activities data by date from '2024-03-08' to '2024-03-15'
r -- Get all kinds of activities data from '0'
s -- Upload activity data from file 'MY_ACTIVITY.fit'
t -- Get all kinds of Garmin device info
u -- Get active goals
v -- Get future goals
w -- Get past goals
y -- Get all Garmin device alarms
x -- Get Heart Rate Variability data (HRV) for '2024-03-15'
z -- Get progress summary from '2024-03-08' to '2024-03-15' for all metrics
A -- Get gear, the defaults, activity types and statistics
B -- Get weight-ins from '2024-03-08' to '2024-03-15'
C -- Get daily weigh-ins for '2024-03-15'
D -- Delete all weigh-ins for '2024-03-15'
E -- Add a weigh-in of 89.6kg on '2024-03-15'
F -- Get virtual challenges/expeditions from '2024-03-08' to '2024-03-15'
G -- Get hill score data from '2024-03-08' to '2024-03-15'
H -- Get endurance score data from '2024-03-08' to '2024-03-15'
I -- Get activities for date '2024-03-15'
J -- Get race predictions
K -- Get all day stress data for '2024-03-15'
L -- Add body composition for '2024-03-15'
M -- Set blood pressure '120,80,80,notes='Testing with example.py'
N -- Get user profile/settings
O -- Reload epoch data for 2024-03-15
P -- Get workouts 0-100, get and download last one to .FIT file
R -- Get solar data from your devices
S -- Get pregnancy summary data
Z -- Remove stored login tokens (logout)
q -- Exit
Make your selection: 
```

[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/cyberjunkynl/)

Python 3 API wrapper for Garmin Connect.

## About

This package allows you to request garmin device, activity and health data from your Garmin Connect account.
See <https://connect.garmin.com/>

## Installation

```bash
pip3 install garminconnect
```

## Authentication

The library uses the same authentication method as the app using [Garth](https://github.com/matin/garth).
The login credentials generated with Garth are valid for a year to avoid needing to login each time.  
NOTE: We obtain the OAuth tokens using the consumer key and secret as the Connect app does.
`garth.sso.OAUTH_CONSUMER` can be set manually prior to calling api.login() if someone wants to use a custom consumer key and secret.

## Testing

The test files use the credential tokens created by `example.py` script, so use that first.

```bash
export GARMINTOKENS=~/.garminconnect
sudo apt install python3-pytest (needed some distros)

make install-test
make test
```

## Development

To create a development environment to commit code.

```
make .venv
source .venv/bin/activate

pip3 install pdm
pip3 install ruff
pdm init

sudo apt install pre-commit isort black mypy
pip3 install pre-commit
```
Run checks before PR/Commit:
```
make format
make lint
make codespell
```

## Publish

To publish new package (author only)

```
sudo apt install twine
vi ~/.pypirc
[pypi]
username = __token__
password = <PyPI token>

make publish
```

## Example
The tests provide examples of how to use the library.  
There is a Jupyter notebook called `reference.ipynb` provided [here](https://github.com/cyberjunky/python-garminconnect/blob/master/reference.ipynb).  
And you can check out the `example.py` code you can find [here](https://raw.githubusercontent.com/cyberjunky/python-garminconnect/master/example.py), you can run it like so:  
```
pip3 install -r requirements-dev.txt
./example.py
```

## Credits

:heart: Special thanks to all people contributed, either by asking questions, reporting bugs, coming up with great ideas, or even by creating whole Pull Requests to add new features!
This project deserves more attention, but I'm struggling to free up time sometimes, so thank you for your patience too!

## Donations

[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/cyberjunkynl/)

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "garminconnect",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "",
    "keywords": "garmin connect api garmin",
    "author": "",
    "author_email": "Ron Klinkien <ron@cyberjunky.nl>",
    "download_url": "https://files.pythonhosted.org/packages/09/82/8964c0ba3dc329261847cded66f20b8a9092f7e59fd690339b9cdd3d82ec/garminconnect-0.2.14.tar.gz",
    "platform": null,
    "description": "# Python: Garmin Connect\n\n```\n$ ./example.py\n*** Garmin Connect API Demo by cyberjunky ***\n\n1 -- Get full name\n2 -- Get unit system\n3 -- Get activity data for '2024-03-15'\n4 -- Get activity data for '2024-03-15' (compatible with garminconnect-ha)\n5 -- Get body composition data for '2024-03-15' (compatible with garminconnect-ha)\n6 -- Get body composition data for from '2024-03-08' to '2024-03-15' (to be compatible with garminconnect-ha)\n7 -- Get stats and body composition data for '2024-03-15'\n8 -- Get steps data for '2024-03-15'\n9 -- Get heart rate data for '2024-03-15'\n0 -- Get training readiness data for '2024-03-15'\n- -- Get daily step data for '2024-03-08' to '2024-03-15'\n/ -- Get body battery data for '2024-03-08' to '2024-03-15'\n! -- Get floors data for '2024-03-08'\n? -- Get blood pressure data for '2024-03-08' to '2024-03-15'\n. -- Get training status data for '2024-03-15'\na -- Get resting heart rate data for 2024-03-15'\nb -- Get hydration data for '2024-03-15'\nc -- Get sleep data for '2024-03-15'\nd -- Get stress data for '2024-03-15'\ne -- Get respiration data for '2024-03-15'\nf -- Get SpO2 data for '2024-03-15'\ng -- Get max metric data (like vo2MaxValue and fitnessAge) for '2024-03-15'\nh -- Get personal record for user\ni -- Get earned badges for user\nj -- Get adhoc challenges data from start '0' and limit '100'\nk -- Get available badge challenges data from '1' and limit '100'\nl -- Get badge challenges data from '1' and limit '100'\nm -- Get non completed badge challenges data from '1' and limit '100'\nn -- Get activities data from start '0' and limit '100'\no -- Get last activity\np -- Download activities data by date from '2024-03-08' to '2024-03-15'\nr -- Get all kinds of activities data from '0'\ns -- Upload activity data from file 'MY_ACTIVITY.fit'\nt -- Get all kinds of Garmin device info\nu -- Get active goals\nv -- Get future goals\nw -- Get past goals\ny -- Get all Garmin device alarms\nx -- Get Heart Rate Variability data (HRV) for '2024-03-15'\nz -- Get progress summary from '2024-03-08' to '2024-03-15' for all metrics\nA -- Get gear, the defaults, activity types and statistics\nB -- Get weight-ins from '2024-03-08' to '2024-03-15'\nC -- Get daily weigh-ins for '2024-03-15'\nD -- Delete all weigh-ins for '2024-03-15'\nE -- Add a weigh-in of 89.6kg on '2024-03-15'\nF -- Get virtual challenges/expeditions from '2024-03-08' to '2024-03-15'\nG -- Get hill score data from '2024-03-08' to '2024-03-15'\nH -- Get endurance score data from '2024-03-08' to '2024-03-15'\nI -- Get activities for date '2024-03-15'\nJ -- Get race predictions\nK -- Get all day stress data for '2024-03-15'\nL -- Add body composition for '2024-03-15'\nM -- Set blood pressure '120,80,80,notes='Testing with example.py'\nN -- Get user profile/settings\nO -- Reload epoch data for 2024-03-15\nP -- Get workouts 0-100, get and download last one to .FIT file\nR -- Get solar data from your devices\nS -- Get pregnancy summary data\nZ -- Remove stored login tokens (logout)\nq -- Exit\nMake your selection: \n```\n\n[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/cyberjunkynl/)\n\nPython 3 API wrapper for Garmin Connect.\n\n## About\n\nThis package allows you to request garmin device, activity and health data from your Garmin Connect account.\nSee <https://connect.garmin.com/>\n\n## Installation\n\n```bash\npip3 install garminconnect\n```\n\n## Authentication\n\nThe library uses the same authentication method as the app using [Garth](https://github.com/matin/garth).\nThe login credentials generated with Garth are valid for a year to avoid needing to login each time.  \nNOTE: We obtain the OAuth tokens using the consumer key and secret as the Connect app does.\n`garth.sso.OAUTH_CONSUMER` can be set manually prior to calling api.login() if someone wants to use a custom consumer key and secret.\n\n## Testing\n\nThe test files use the credential tokens created by `example.py` script, so use that first.\n\n```bash\nexport GARMINTOKENS=~/.garminconnect\nsudo apt install python3-pytest (needed some distros)\n\nmake install-test\nmake test\n```\n\n## Development\n\nTo create a development environment to commit code.\n\n```\nmake .venv\nsource .venv/bin/activate\n\npip3 install pdm\npip3 install ruff\npdm init\n\nsudo apt install pre-commit isort black mypy\npip3 install pre-commit\n```\nRun checks before PR/Commit:\n```\nmake format\nmake lint\nmake codespell\n```\n\n## Publish\n\nTo publish new package (author only)\n\n```\nsudo apt install twine\nvi ~/.pypirc\n[pypi]\nusername = __token__\npassword = <PyPI token>\n\nmake publish\n```\n\n## Example\nThe tests provide examples of how to use the library.  \nThere is a Jupyter notebook called `reference.ipynb` provided [here](https://github.com/cyberjunky/python-garminconnect/blob/master/reference.ipynb).  \nAnd you can check out the `example.py` code you can find [here](https://raw.githubusercontent.com/cyberjunky/python-garminconnect/master/example.py), you can run it like so:  \n```\npip3 install -r requirements-dev.txt\n./example.py\n```\n\n## Credits\n\n:heart: Special thanks to all people contributed, either by asking questions, reporting bugs, coming up with great ideas, or even by creating whole Pull Requests to add new features!\nThis project deserves more attention, but I'm struggling to free up time sometimes, so thank you for your patience too!\n\n## Donations\n\n[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/cyberjunkynl/)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python 3 API wrapper for Garmin Connect",
    "version": "0.2.14",
    "project_urls": {
        "Bug tracker": "https://github.com/cyberjunky/python-garminconnect/issues",
        "Homepage": "https://github.com/cyberjunky/python-garminconnect"
    },
    "split_keywords": [
        "garmin",
        "connect",
        "api",
        "garmin"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "57b56c04bb29d098bd3a7c43ba6722f4e34c36a666068547cd6ad7e19d00aff7",
                "md5": "434375f9a6be4edeb7fa2e268d8c2285",
                "sha256": "f5f07d9e3d9b131b60563c6b1e1c5890a62f6e77fc88a92e1697f674d1790ab0"
            },
            "downloads": -1,
            "filename": "garminconnect-0.2.14-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "434375f9a6be4edeb7fa2e268d8c2285",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 11921,
            "upload_time": "2024-03-15T14:30:26",
            "upload_time_iso_8601": "2024-03-15T14:30:26.637000Z",
            "url": "https://files.pythonhosted.org/packages/57/b5/6c04bb29d098bd3a7c43ba6722f4e34c36a666068547cd6ad7e19d00aff7/garminconnect-0.2.14-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "09828964c0ba3dc329261847cded66f20b8a9092f7e59fd690339b9cdd3d82ec",
                "md5": "efcafd22ab67566d80854c909bc5e007",
                "sha256": "186d182083843e57b80933beb91b9f710cb8c25c39db7b30d4f78758fbd89079"
            },
            "downloads": -1,
            "filename": "garminconnect-0.2.14.tar.gz",
            "has_sig": false,
            "md5_digest": "efcafd22ab67566d80854c909bc5e007",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 81163,
            "upload_time": "2024-03-15T14:30:28",
            "upload_time_iso_8601": "2024-03-15T14:30:28.951277Z",
            "url": "https://files.pythonhosted.org/packages/09/82/8964c0ba3dc329261847cded66f20b8a9092f7e59fd690339b9cdd3d82ec/garminconnect-0.2.14.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-15 14:30:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cyberjunky",
    "github_project": "python-garminconnect",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "garminconnect"
}
        
Elapsed time: 0.22000s