Skip to main content

Module fetch

Module fetch 

Source
Expand description

Downloading a URL into the job’s directory.

A corpus that lives on the web is still a corpus. Without this, every job reading public data has to be preceded by a hand-written download script — which is what real users did: 120 lines of Python to pull CMS listings before cuttlefish saw a single byte. That work is outside the pipeline, so it gets none of what the pipeline provides: no capability check, no per-item failure isolation, no resume, no ledger.

The result is a file in the job directory, opened as an ordinary handle. That is the whole design: a fetched resource is indistinguishable downstream from a local one, so slice, identify, document_text, page_image and the rest work on it with no further changes.

Functions§

fetch_to_file
Fetch url into job_dir/fetched/, returning the file’s path.