datalad_next.url_operations.SshUrlOperations

class datalad_next.url_operations.SshUrlOperations(*, cfg: ConfigManager | None = None)[source]

Bases: UrlOperations

Handler for operations on ssh:// URLs

For downloading files, only servers that support execution of the commands 'printf', 'ls -nl', 'awk', and 'cat' are supported. This includes a wide range of operating systems, including devices that provide these commands via the 'busybox' software.

Note

The present implementation does not support SSH connection multiplexing, (re-)authentication is performed for each request. This limitation is likely to be removed in the future, and connection multiplexing supported where possible (non-Windows platforms).

download(from_url: str, to_path: Path | None, *, credential: str | None = None, hash: list[str] | None = None, timeout: float | None = None) Dict[source]

Download a file by streaming it through an SSH connection.

On the server-side, the file size is determined and sent. Afterwards the file content is sent via cat to the SSH client.

See datalad_next.url_operations.UrlOperations.download() for parameter documentation and exception behavior.

stat(url: str, *, credential: str | None = None, timeout: float | None = None) Dict[source]

Gather information on a URL target, without downloading it

See datalad_next.url_operations.UrlOperations.stat() for parameter documentation and exception behavior.

upload(from_path: Path | None, to_url: str, *, credential: str | None = None, hash: list[str] | None = None, timeout: float | None = None) Dict[source]

Upload a file by streaming it through an SSH connection.

It, more or less, runs ssh <host> 'cat > <path>'.

See datalad_next.url_operations.UrlOperations.upload() for parameter documentation and exception behavior.