File System¶
Client for accessing the user remote file system
-
class
slipo.filesystem.
FileSystemClient
(base_url, api_key)[source]¶ FileSystemClient provides methods for browsing, uploading and downloading files from the user remote file system.
Details about the API responses are available at the SLIPO site.
- Parameters
base_url (str) – Base URL for SLIPO API endpoints. The default value is
https://app.dev.slipo.eu/
.api_key (str) – SLIPO API key. An application key can be generated using the SLIPO Workbench application.
- Returns
A
FileSystemClient
object.
-
browse
() → dict[source]¶ Browse all files and folders on the remote file system.
- Returns
A
dict
representing the parsed JSON response.- Raises
SlipoException – If a network or server error has occurred.
-
download
(source: str, target: str, overwrite: bool = False) → None[source]¶ Download a file from the remote file system.
- Parameters
source (str) – Relative file path on the remote file system.
target (str) – The path where to save the file.
overwrite (bool, optional) – Set true if the operation should overwrite any existing file.
- Raises
SlipoException – If a network, server error or I/O error has occurred.
-
upload
(source, target, overwrite=False) → dict[source]¶ Upload a file to the remote file system.
Note
File size constraints are enforced on the uploaded file. The default installation allows files up to 20 Mb.
Moreover, space quotas are applied on the server. The default user space is 5GB.
Directory nesting constraints are applied for the
target
value. The default installation allows nesting of directories up to 5 levels.- Parameters
source (str) – The path of the file to upload.
target (str) – Relative path on the remote file system where to save the file. If the directory does not exist, it will be created.
overwrite (bool, optional) – Set true if the operation should overwrite any existing file.
- Raises
SlipoException – If a network, server error or I/O error has occurred.