Loading...
Loading...
Compare original and translation side by side
~/.strava/metadata.json~/.strava/metadata.jsonpython3 scripts/strava_api.py athletepython3 scripts/strava_api.py athletehttp://localhostlocalhosthttp://localhostlocalhostpython3 scripts/setup_oauth.py~/.strava/metadata.jsonpython3 scripts/setup_oauth.py~/.strava/metadata.jsonpython3 scripts/strava_api.py athletepython3 scripts/strava_api.py athleteundefinedundefinedundefinedundefinedfrom scripts.strava_api import StravaClient
client = StravaClient() # Auto-loads from keychain, refreshes token if neededfrom scripts.strava_api import StravaClient
client = StravaClient() # 自动从密钥链加载,必要时刷新令牌undefinedundefinedundefinedundefined
---
---User Request
├── First time / "setup strava" → Run setup_oauth.py
├── "Get my profile/stats" → strava_api.py athlete/stats
├── "List my activities" → strava_api.py activities
├── "Get activity details" → strava_api.py activity {id}
├── "Create/log activity" → client.create_activity()
├── "Update activity" → client.update_activity()
├── "Get training data/streams" → client.get_activity_streams()
├── "Find segments nearby" → strava_api.py segments {bounds}
├── "Export route" → raw GET /routes/{id}/export_gpx
└── "Token expired" → Auto-handled by client用户请求
├── 首次使用 / "setup strava"(配置Strava)→ 运行setup_oauth.py
├── "获取我的档案/统计数据" → strava_api.py athlete/stats
├── "列出我的活动" → strava_api.py activities
├── "获取活动详情" → strava_api.py activity {id}
├── "创建/记录活动" → client.create_activity()
├── "更新活动" → client.update_activity()
├── "获取训练数据/数据流" → client.get_activity_streams()
├── "查找附近路段" → strava_api.py segments {bounds}
├── "导出路线" → 原始GET请求 /routes/{id}/export_gpx
└── "令牌过期" → 由客户端自动处理| Item | Value |
|---|---|
| Secrets storage | System Keychain (secure) |
| Metadata location | |
| Base URL | |
| Rate limits | 100 req/15min, 1000 req/day |
| Token lifetime | 6 hours (auto-refresh) |
| 项目 | 值 |
|---|---|
| 密钥存储 | 系统密钥链(安全) |
| 元数据位置 | |
| 基础URL | |
| 速率限制 | 15分钟100次请求,每日1000次请求 |
| 令牌有效期 | 6小时(自动刷新) |
RunTrailRunVirtualRunRideMountainBikeRideGravelRideEBikeRideSwimWalkHikeWorkoutWeightTrainingYogaRunTrailRunVirtualRunRideMountainBikeRideGravelRideEBikeRideSwimWalkHikeWorkoutWeightTrainingYoga| Status | Meaning | Action |
|---|---|---|
| 401 | Token expired | Auto-handled by client |
| 403 | Insufficient scope | Re-run setup_oauth.py |
| 404 | Resource not found | Check ID |
| 429 | Rate limit | Wait 15 min |
| 状态码 | 含义 | 操作 |
|---|---|---|
| 401 | 令牌过期 | 由客户端自动处理 |
| 403 | 权限不足 | 重新运行setup_oauth.py |
| 404 | 资源不存在 | 检查ID是否正确 |
| 429 | 超出速率限制 | 等待15分钟 |