46 lines
1.4 KiB
Python
46 lines
1.4 KiB
Python
|
|
import logging
|
|
import sys
|
|
import os
|
|
|
|
# Adjust path to find backend modules
|
|
sys.path.append(os.path.abspath("/home/sstent/Projects/FitTrack2/FitnessSync/backend"))
|
|
|
|
from src.services.garmin.client import GarminClient
|
|
from sqlalchemy import create_engine
|
|
from sqlalchemy.orm import sessionmaker
|
|
from src.models import Base
|
|
from src.services.postgresql_manager import PostgreSQLManager
|
|
|
|
# Mock/Setup DB connection to load tokens
|
|
DATABASE_URL = "postgresql://user:password@localhost:5432/fitness_sync"
|
|
engine = create_engine(DATABASE_URL)
|
|
SessionLocal = sessionmaker(bind=engine)
|
|
db = SessionLocal()
|
|
|
|
try:
|
|
client = GarminClient()
|
|
if client.load_tokens(db):
|
|
print("Tokens loaded.")
|
|
# Fetch 1 activity
|
|
activities = client.get_activities('2025-12-01', '2026-01-01') # Adjust dates to find recent ones
|
|
if activities:
|
|
act = activities[0]
|
|
print("\n--- Available Keys in Activity Metadata ---")
|
|
for k in sorted(act.keys()):
|
|
val = act[k]
|
|
# Truncate long values
|
|
val_str = str(val)
|
|
if len(val_str) > 50: val_str = val_str[:50] + "..."
|
|
print(f"{k}: {val_str}")
|
|
|
|
print(f"\nTotal keys: {len(act.keys())}")
|
|
else:
|
|
print("No activities found in range.")
|
|
else:
|
|
print("Failed to load tokens.")
|
|
except Exception as e:
|
|
print(f"Error: {e}")
|
|
finally:
|
|
db.close()
|