From f09c6850bcf981341a4d38ab2cd1de4f0a9f7755 Mon Sep 17 00:00:00 2001 From: zayd Date: Wed, 15 Apr 2026 17:37:25 -0700 Subject: [PATCH] feat: multi-key rotation for SCRAPECREATORS_API_KEY Support comma-separated API keys in SCRAPECREATORS_API_KEY with random selection per run, distributing load across multiple free-tier accounts. Co-Authored-By: Claude Opus 4.6 --- scripts/lib/env.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/lib/env.py b/scripts/lib/env.py index 601c163..46c3394 100644 --- a/scripts/lib/env.py +++ b/scripts/lib/env.py @@ -278,6 +278,13 @@ def get_config() -> dict[str, Any]: else: config['_CONFIG_SOURCE'] = 'env_only' + # Resolve comma-separated SCRAPECREATORS_API_KEY — pick one randomly for load distribution + 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 '' + # Extract browser credentials if configured browser_creds = extract_browser_credentials(config) for key, value in browser_creds.items():