vimsheet.fetch.fetch_worker
Low-level HTTP fetch helpers — no Textual or VimSheet model imports.
- class vimsheet.fetch.fetch_worker.FetchResult(raw: 'bytes | None', status_code: 'int | None', error: 'str | None')[source]
Bases:
object
- vimsheet.fetch.fetch_worker.parse_curl_command(cmd)[source]
Parse a curl command string into url, headers, and method.
- Parameters:
cmd (
str) –A command that starts with
curl, e.g.:curl -H "Authorization: Bearer $TOKEN" https://api.example.com/data
- Returns:
- Return type:
- vimsheet.fetch.fetch_worker.do_fetch(url, timeout=10.0, headers=None, method='GET')[source]
Blocking HTTP request. Tries
requestsfirst, falls back tourllib.
- vimsheet.fetch.fetch_worker.parse_response(result)[source]
Parse a successful FetchResult into a Python object.
Tries JSON first; returns the raw text string on JSON parse failure.
- Parameters:
result (FetchResult)
- Return type:
- vimsheet.fetch.fetch_worker.extract_json_path(data, path)[source]
Traverse data using dot-and-bracket notation.
Examples
“” → data unchanged “price” → data[“price”] “data.price” → data[“data”][“price”] “items[0].name” → data[“items”][0][“name”]
Raises KeyError / IndexError / TypeError on invalid paths.