-
Notifications
You must be signed in to change notification settings - Fork 71
Fix: updated POST Login headers to bypass new cloudflare block #226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
brunosantos
wants to merge
3
commits into
matin:main
Choose a base branch
from
brunosantos:patch-1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,34 +1,104 @@ | ||
| # Garth | ||
|
|
||
| > **Garth is deprecated and no longer maintained.** Garmin changed their auth | ||
| > flow, breaking the mobile auth approach that Garth depends on. I'm not in a | ||
| > position to dedicate the time to adapt to these changes. See the | ||
| > [announcement](https://github.com/matin/garth/discussions/222) for details. | ||
| > Anyone is welcome to fork Garth as a starting point for a new library. | ||
|
|
||
| [](https://github.com/matin/garth/actions/workflows/ci.yml?query=event%3Apush+branch%3Amain+workflow%3ACI) | ||
| [](https://codecov.io/gh/matin/garth) | ||
| [](https://pypi.org/project/garth/) | ||
| [](https://pypistats.org/packages/garth) | ||
| [](https://garth.readthedocs.io) | ||
|
|
||
| Garmin SSO auth + Connect Python client | ||
|
|
||
| ## About | ||
| ## Features | ||
|
|
||
| - OAuth1/OAuth2 authentication (OAuth1 token lasts ~1 year) | ||
| - MFA support with custom handlers | ||
| - Auto-refresh of OAuth2 token | ||
| - Auto-resume from `GARTH_HOME` or `GARTH_TOKEN` environment variables | ||
| - Works on Google Colab | ||
| - Pydantic dataclasses for validated data | ||
| - Built-in telemetry for diagnosing auth issues | ||
| - Full test coverage | ||
|
|
||
| ## Installation | ||
|
|
||
| ```bash | ||
| pip install garth | ||
| ``` | ||
|
|
||
| ## Quick Start | ||
|
|
||
| ### Authenticate and save session | ||
|
|
||
| ```python | ||
| import garth | ||
| from getpass import getpass | ||
|
|
||
| garth.login(input("Email: "), getpass("Password: ")) | ||
| garth.save("~/.garth") | ||
| ``` | ||
|
|
||
| ### Resume session | ||
|
|
||
| ```python | ||
| import garth | ||
| from garth.exc import GarthException | ||
|
|
||
| Garth was a Python library for Garmin Connect API access with OAuth | ||
| authentication. It reached 350k+ downloads per month and was translated into | ||
| multiple programming languages. | ||
| garth.resume("~/.garth") | ||
| try: | ||
| garth.client.username | ||
| except GarthException: | ||
| # Session is expired. You'll need to log in again | ||
| pass | ||
| ``` | ||
|
|
||
| Garmin recently changed their auth flow, breaking the mobile auth approach | ||
| that Garth and other libraries depend on | ||
| ([#217](https://github.com/matin/garth/issues/217)). This is the final | ||
| release. | ||
| Or use environment variables for automatic session restoration: | ||
|
|
||
| ## For existing users | ||
| ```bash | ||
| export GARTH_HOME=~/.garth | ||
| # or | ||
| export GARTH_TOKEN="eyJvYXV0aF90b2tlbi..." # from `uvx garth login` | ||
| ``` | ||
|
|
||
| If you already have a saved session with a valid OAuth1 token, Garth may | ||
| continue to work until that token expires (~1 year from when it was issued). | ||
| New logins will not work. | ||
| ```python | ||
| import garth | ||
| # Session is automatically loaded | ||
| garth.client.username | ||
| ``` | ||
|
|
||
| ### Fetch data | ||
|
|
||
| ```python | ||
| # Get daily stress | ||
| garth.DailyStress.list("2023-07-23", 7) | ||
|
|
||
| # Get sleep data | ||
| garth.SleepData.get("2023-07-20") | ||
|
|
||
| # Get weight | ||
| garth.WeightData.list("2025-06-01", 30) | ||
|
|
||
| # Direct API calls | ||
| garth.connectapi("/usersummary-service/stats/stress/weekly/2023-07-05/52") | ||
| ``` | ||
|
|
||
| ## Documentation | ||
|
|
||
| Documentation is still available at | ||
| **[garth.readthedocs.io](https://garth.readthedocs.io)** for reference. | ||
| Full documentation at **[garth.readthedocs.io](https://garth.readthedocs.io)** | ||
|
|
||
| ## MCP Server | ||
|
|
||
| [`garth-mcp-server`](https://github.com/matin/garth-mcp-server) is in early development. | ||
|
|
||
| To generate your `GARTH_TOKEN`, use `uvx garth login`. | ||
|
|
||
| ## Star History | ||
|
|
||
| <!-- markdownlint-disable MD013 --> | ||
| <a href="https://www.star-history.com/#matin/garth&Date"> | ||
| <picture> | ||
| <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=matin/garth&type=Date&theme=dark" /> | ||
| <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=matin/garth&type=Date" /> | ||
| <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=matin/garth&type=Date" /> | ||
| </picture> | ||
| </a> | ||
| <!-- markdownlint-enable MD013 --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| __version__ = "0.8.0" | ||
| __version__ = "0.7.12" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaking change: telemetry now enabled by default.
Changing defaults from
FalsetoTruefor bothenabledandsend_to_logfireis a significant behavioral change. Per the context snippet fromhttp.py:67-68, this means:print(f"Garth session: {self.telemetry.session_id}")output at import timeWhile the data is sanitized, this is an opt-out change that may surprise existing users. Consider:
enabled=Falseas default and requiring explicit opt-in for telemetry collection🤖 Prompt for AI Agents