download_captchas

download_captchas(
    source,
    n,
    dest_dir,
    *,
    sleep=0.0,
    timeout=30.0,
    max_attempts=None,
    on_error='skip',
)

Download up to n captchas from source into dest_dir.

Each successful fetch is written as <source>_<hex>.<ext>. Network or parse failures are logged as warnings and skipped (on_error='skip', default); pass on_error='raise' to propagate instead. n is a target, not a guarantee — the function gives up after max_attempts total failed attempts (default max(10, n * 3)), so a site that’s completely down will not hang.

Returns the list of written file paths.