From a4f1f948022914f1fecf5c8b9f9236cf2b905782 Mon Sep 17 00:00:00 2001 From: Trevin Chow Date: Sun, 17 May 2026 01:29:06 -0700 Subject: [PATCH] fix(env): restore multi-key rotation for SCRAPECREATORS_API_KEY Originally added in #268 to spread load across free-tier accounts when SCRAPECREATORS_API_KEY is set to a comma-separated list. The 7-line block was inadvertently dropped during the v3.0.6 consolidation (d14814a) even though the changelog still advertised the feature. Re-apply the same random.choice rotation in get_config() so user-facing behavior matches the documented contract. Closes #287. Co-authored-by: Eric Oberhofer --- skills/last30days/scripts/lib/env.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/skills/last30days/scripts/lib/env.py b/skills/last30days/scripts/lib/env.py index ec20bb2..7c44a7b 100644 --- a/skills/last30days/scripts/lib/env.py +++ b/skills/last30days/scripts/lib/env.py @@ -352,6 +352,15 @@ def get_config() -> dict[str, Any]: if legacy: config['SCRAPECREATORS_API_KEY'] = legacy + # Multi-key rotation: comma-separated SCRAPECREATORS_API_KEY round-robins + # via random.choice per run. Originally added in #268, accidentally dropped + # in v3.0.6, restored here. + sc_key_raw = config.get('SCRAPECREATORS_API_KEY') or '' + if ',' in sc_key_raw: + import random + sc_keys = [k.strip() for k in sc_key_raw.split(',') if k.strip()] + config['SCRAPECREATORS_API_KEY'] = random.choice(sc_keys) if sc_keys else '' + # Track which config source was used (highest-priority file source wins # the label; keychain is only reported when nothing else is configured). if project_env_path: