fix: 修复每日任务批量请求被 goals-api 拒绝(400) - #1
Open
Unicorn88b wants to merge 2 commits into
Open
Conversation
goals-api 的 /progress/batch 只接受带 UTC 标识的 ISO-8601 时间戳, 原先传入无时区的本地时间导致固定返回 400。 - 新增 _goals_timestamp() 生成毫秒级 UTC 时间戳 - 新增 _goals_timezone() 统一时区推导,优先使用 TZ 中的 IANA 名 - 批量请求调用两次以触发奖章结算,失败时输出 HTTP 状态码 - 移除 _get_quest_schema 中无效的 duo_get 调用 同时加入无人值守脚本 src/daily.py、GitHub Actions 定时任务、 .env.example 与 .gitignore,并更新中英文 README。
- streak_done_today 改用账号时区(updatedTimeZone / TZ)判定当日, 优先读取已是本地日期的 lastExtendedDate / endDate, 避免东八区凌晨把昨晚的连胜误判为今日已完成 - .gitignore 补上 Launcher 实际使用的 .pylingo_cache/, 该目录会存放含 JWT 的 accounts.json - README 中英文的启动命令改为 Launcher/Launcher.py 与 src/main.py, 缓存结构同步更新为真实布局
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
问题
每日任务(Daily Quests)始终失败,连续三次重试后放弃:
根因
_brute_force_quests的timestamp字段使用datetime.now().isoformat(),生成的是不带时区标识的本地时间(如2026-08-09T18:49:49.702996)。goals-api.duolingo.com的/users/{id}/progress/batch只接受带 UTC 标识的 ISO-8601,因此固定返回400 Bad Request:请求体的其他部分(metric 列表、批次大小、
timezone)均无问题——已验证 48 个 metric 的完整批次和分片批次在时间戳正确时都返回 200。改动
src/main.py:_goals_timestamp(),输出毫秒级 UTC 时间戳(2026-08-09T10:49:49.703Z)_goals_timezone(),统一原先重复三处的时区推导逻辑;优先使用TZ中的 IANA 名(如Asia/Shanghai),否则回退到UTC±HH:MM_get_quest_schema中一行无效的duo_get(向www.duolingo.com请求/schema,结果立即被后续 goals-api 请求覆盖)同时纳入本分支的配套内容:无人值守脚本
src/daily.py、GitHub Actions 定时任务、.env.example、.gitignore,以及中英文 README 更新。验证
退出码 0(修复前为 1)。凭据通过
.env提供,未包含在提交中。