first commit

This commit is contained in:
2026-05-18 12:53:24 -04:00
commit c7f6f68c40
23693 changed files with 8967 additions and 0 deletions

31
auth.py Normal file
View File

@@ -0,0 +1,31 @@
"""One-time login to Garmin Connect; saves OAuth tokens to .secrets/.
Usage:
uv run auth.py
Prompts for email + password (and MFA code if your account has 2FA).
Tokens are refreshed automatically by sync.py on subsequent runs
(valid ~1 year).
"""
import getpass
import os
from pathlib import Path
import garth
TOKEN_DIR = Path(__file__).parent / ".secrets"
def main() -> None:
TOKEN_DIR.mkdir(exist_ok=True)
email = os.environ.get("GARMIN_EMAIL") or input("Garmin email: ").strip()
password = os.environ.get("GARMIN_PASSWORD") or getpass.getpass("Garmin password: ")
garth.login(email, password)
garth.save(TOKEN_DIR)
profile = garth.client.username
print(f"Logged in as {profile}. Tokens saved to {TOKEN_DIR}.")
if __name__ == "__main__":
main()