hopsworks_common.core.rest #
Stable internal REST helper for SDK consumers (CLI and core/<entity>_api modules).
The Hopsworks Python SDK already has an authenticated HTTP client at hopsworks_common.client.get_instance(), but its surface (_send_request, _project_id) is private — the underscore prefix means callers shouldn't depend on it. Multiple call sites (the hops CLI's fv list, connector list, model list, …) reach through anyway because the SDK's per-entity wrappers don't yet cover every endpoint.
This module exposes the bare minimum stable surface for those call sites:
- :func:
send_request— perform a request against/hopsworks-api/api/...with shared host/auth/TLS configuration. - :func:
project_path— build aproject/<id>/...path tuple so callers don't reach into_project_iddirectly.
Internal SDK consumers should import from here rather than client.get_instance() directly so the underlying HTTP machinery can change shape without breaking external callers.
project_path #
Build a ["project", <project_id>, *tail] path list.
| PARAMETER | DESCRIPTION |
|---|---|
*tail | Path components to append after TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
list[Any] | A list ready to pass as |
| RAISES | DESCRIPTION |
|---|---|
RuntimeError | When the SDK is not connected ( |
send_request #
send_request(
method: str,
path_params: list[Any],
query_params: dict[str, Any] | None = None,
json_body: Any | None = None,
) -> Any
Issue an authenticated request to /hopsworks-api/api/<path_params>.
Wraps the SDK's internal client so per-call sites don't reach into _send_request directly. Auth, host normalization, TLS verification and base URL construction are all inherited from the active :func:hopsworks_common.client.get_instance instance — the same one the rest of the SDK uses.
| PARAMETER | DESCRIPTION |
|---|---|
method | HTTP method ( TYPE: |
path_params | List of path components (URL-encoded by the client). |
query_params | Optional query string parameters. |
json_body | Optional Python object to serialize as the JSON request body. The TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Any | The JSON-decoded response body, or whatever the client's |
Any |
|
| RAISES | DESCRIPTION |
|---|---|
hopsworks_common.client.exceptions.RestAPIError | When the backend returns a non-2xx response. |