datasheet_fetch
Downloads a datasheet PDF into the workspace and returns its local path so you can read package drawings and recommended land patterns.
Instructions
Download a datasheet PDF into the workspace and return its path.
Read the returned path yourself (the pages with the package
drawing and the recommended land pattern); nothing here parses the
PDF. The file is kept under <workspace>/datasheets, named by a
hash of the URL, with a JSON sidecar recording the URL, part
number, SHA-256, size and fetch time, so a second call for the same
URL is answered from the cache (cache: "hit") with the same
bytes. A cached copy that no longer matches its recorded hash is
fetched again.
Refused, with nothing stored: a URL that is not http or https; a
file over 50 MB; a server that does not answer within 60 s; and a
reply that is not a PDF (no %PDF header), which is what a login
or cookie page looks like. For those, download the file in a
browser and read the local copy.
Args: url: the datasheet's http or https URL, ideally the manufacturer's own. part_number: recorded in the sidecar, for the citation.
Returns:
{ok, path, sidecar, cache, url, final_url, sha256, size, pages, pages_approximate, pages_method, fetched_at}. pages
is counted from the page objects in the file without a PDF
parser and can be None or off for a compressed file.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | ||
| part_number | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||