INNER CODE UNIT · Python
_api_keyword_task
atenreiro/opensquat · opensquat/app.py:230
def _api_keyword_task(client, dns_validator, rate_limiter, fuzziness, history_days, max_results,
keyword, idx, total):
"""Worker for one keyword in API mode. Runs in a thread."""
result_buffer = io.StringIO()
print(
Fore.WHITE +
f"\n[*] Querying API for keyword: {keyword} [ {idx} / {total} ]" +
Style.RESET_ALL,
file=result_buffer,
)
# Respect the shared rate limiter before issuing the HTTP call.
# No-op when the user didn't set --api-rate-limit.
rate_limiter.wait()
try:
result = client.lookalike(
keyword,
fuzziness=fuzziness,
history_days=history_days,