INNER CODE UNIT · Python
_run_api_worker
atenreiro/opensquat · opensquat/app.py:285
def _run_api_worker(self, api_options):
"""
Run --api mode. One APIClient shared across a thread pool, one task
per keyword. Honors --dns by annotating each returned domain and
--api-rate-limit by capping outbound request rate across all workers.
Stops on:
- quota exhaustion (429 without Retry-After) — red warning, partial
results, forces api_balance to 0
- rate limit (429 with Retry-After) — yellow warning, partial
results, preserves the real api_balance
- auth error (401) — red error, exit(-1)
- plan error (403) — red error, exit(-1)
"""
if api_options is None or not api_options.api_key:
print(
Style.BRIGHT + Fore.RED +
"[ERROR] API mode requires an api_key in api_options" +