|
1 | 1 | # Garth |
2 | 2 |
|
3 | | -[](https://github.com/matin/garth/actions/workflows/ci.yml?query=event%3Apush+branch%3Amain+workflow%3ACI) |
4 | | -[](https://codecov.io/gh/matin/garth) |
| 3 | +> **Garth is deprecated and no longer maintained.** Garmin changed their auth |
| 4 | +> flow, breaking the mobile auth approach that Garth depends on. I'm not in a |
| 5 | +> position to dedicate the time to adapt to these changes. See the |
| 6 | +> [announcement](https://github.com/matin/garth/discussions/222) for details. |
| 7 | +> Anyone is welcome to fork Garth as a starting point for a new library. |
| 8 | +
|
5 | 9 | [](https://pypi.org/project/garth/) |
6 | 10 | [](https://pypistats.org/packages/garth) |
7 | | -[](https://garth.readthedocs.io) |
8 | 11 |
|
9 | 12 | Garmin SSO auth + Connect Python client |
10 | 13 |
|
11 | | -## Features |
12 | | - |
13 | | -- OAuth1/OAuth2 authentication (OAuth1 token lasts ~1 year) |
14 | | -- MFA support with custom handlers |
15 | | -- Auto-refresh of OAuth2 token |
16 | | -- Auto-resume from `GARTH_HOME` or `GARTH_TOKEN` environment variables |
17 | | -- Works on Google Colab |
18 | | -- Pydantic dataclasses for validated data |
19 | | -- Built-in telemetry for diagnosing auth issues |
20 | | -- Full test coverage |
21 | | - |
22 | | -## Installation |
23 | | - |
24 | | -```bash |
25 | | -pip install garth |
26 | | -``` |
27 | | - |
28 | | -## Quick Start |
29 | | - |
30 | | -### Authenticate and save session |
31 | | - |
32 | | -```python |
33 | | -import garth |
34 | | -from getpass import getpass |
35 | | - |
36 | | -garth.login(input("Email: "), getpass("Password: ")) |
37 | | -garth.save("~/.garth") |
38 | | -``` |
39 | | - |
40 | | -### Resume session |
41 | | - |
42 | | -```python |
43 | | -import garth |
44 | | -from garth.exc import GarthException |
| 14 | +## About |
45 | 15 |
|
46 | | -garth.resume("~/.garth") |
47 | | -try: |
48 | | - garth.client.username |
49 | | -except GarthException: |
50 | | - # Session is expired. You'll need to log in again |
51 | | - pass |
52 | | -``` |
| 16 | +Garth was a Python library for Garmin Connect API access with OAuth |
| 17 | +authentication. It reached 350k+ downloads per month and was translated into |
| 18 | +multiple programming languages. |
53 | 19 |
|
54 | | -Or use environment variables for automatic session restoration: |
| 20 | +Garmin recently changed their auth flow, breaking the mobile auth approach |
| 21 | +that Garth and other libraries depend on |
| 22 | +([#217](https://github.com/matin/garth/issues/217)). This is the final |
| 23 | +release. |
55 | 24 |
|
56 | | -```bash |
57 | | -export GARTH_HOME=~/.garth |
58 | | -# or |
59 | | -export GARTH_TOKEN="eyJvYXV0aF90b2tlbi..." # from `uvx garth login` |
60 | | -``` |
| 25 | +## For existing users |
61 | 26 |
|
62 | | -```python |
63 | | -import garth |
64 | | -# Session is automatically loaded |
65 | | -garth.client.username |
66 | | -``` |
67 | | - |
68 | | -### Fetch data |
69 | | - |
70 | | -```python |
71 | | -# Get daily stress |
72 | | -garth.DailyStress.list("2023-07-23", 7) |
73 | | - |
74 | | -# Get sleep data |
75 | | -garth.SleepData.get("2023-07-20") |
76 | | - |
77 | | -# Get weight |
78 | | -garth.WeightData.list("2025-06-01", 30) |
79 | | - |
80 | | -# Direct API calls |
81 | | -garth.connectapi("/usersummary-service/stats/stress/weekly/2023-07-05/52") |
82 | | -``` |
| 27 | +If you already have a saved session with a valid OAuth1 token, Garth may |
| 28 | +continue to work until that token expires (~1 year from when it was issued). |
| 29 | +New logins will not work. |
83 | 30 |
|
84 | 31 | ## Documentation |
85 | 32 |
|
86 | | -Full documentation at **[garth.readthedocs.io](https://garth.readthedocs.io)** |
87 | | - |
88 | | -## MCP Server |
89 | | - |
90 | | -[`garth-mcp-server`](https://github.com/matin/garth-mcp-server) is in early development. |
91 | | - |
92 | | -To generate your `GARTH_TOKEN`, use `uvx garth login`. |
93 | | - |
94 | | -## Star History |
95 | | - |
96 | | -<!-- markdownlint-disable MD013 --> |
97 | | -<a href="https://www.star-history.com/#matin/garth&Date"> |
98 | | - <picture> |
99 | | - <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=matin/garth&type=Date&theme=dark" /> |
100 | | - <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=matin/garth&type=Date" /> |
101 | | - <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=matin/garth&type=Date" /> |
102 | | - </picture> |
103 | | -</a> |
104 | | -<!-- markdownlint-enable MD013 --> |
| 33 | +Documentation is still available at |
| 34 | +**[garth.readthedocs.io](https://garth.readthedocs.io)** for reference. |
0 commit comments