httk.core.fetching¶
Fetch URL sources through OPTIMADE or the registered file-reader pipeline.
Functions¶
|
Fetch a URL as an OPTIMADE entry or a registered file format. |
Module Contents¶
- httk.core.fetching.fetch(url, *, raw=False, timeout=None, kind=None, **kwargs)[source]¶
Fetch a URL as an OPTIMADE entry or a registered file format.
kind="optimade"forces OPTIMADE handling andkind="load"forces file-reader handling. With nokind, a reader-claimed extension wins over an OPTIMADE-shaped path; a reader-claimed basename is ambiguous and requires an explicitkind.file://URLs are supported in either branch. Redirects followurllibdefaults.As the explicit URL entry point, this function supplies the same network consent represented by
DatastreamURL; it does not use implicit bare-string network access for the reader branch.- Parameters:
url (str) – URL to fetch.
raw (bool) – Whether to return a neutral payload without a format adapter.
timeout (float | None) – Optional timeout for URL-backed reader access or OPTIMADE requests.
kind (str | None) – Optional branch selector:
"optimade"or"load".**kwargs (Any) – Additional options passed to the file reader.
- Returns:
The fetched OPTIMADE resource or loaded file value.
- Raises:
ValueError – If the URL,
kind, or automatic branch selection is invalid.- Return type:
Any