Upload
Upload a local file to a node and transfer it to its filesystem
Signature
def upload(node_id: str, file_path: str, destination_path: str = "/home/ubuntu/Desktop/MY_FILES/") -> UploadResponseParameters
node_id(str) – target nodefile_path(str) – local path to the filedestination_path(str, optional) – directory path on the node where the file will be placed (defaults to/home/ubuntu/Desktop/MY_FILES/)
Path Handling
Important: destination_path is a directory path, not a file path. Your original filename from file_path is preserved and placed in the destination directory.
Default: /home/ubuntu/Desktop/MY_FILES/
Any provided destination_path is constrained to /home/ubuntu/. Paths are automatically adjusted:
- Absolute path starting with
/home/ubuntu/: Used as-is- Example:
/home/ubuntu/data/→/home/ubuntu/data/
- Example:
- Absolute path starting with
/: Forced under/home/ubuntu/- Example:
/data/→/home/ubuntu/data/
- Example:
- Relative path: Appended to
/home/ubuntu/- Example:
data/→/home/ubuntu/data/
- Example:
Returns
UploadResponse object with:
status(str) – operation statusfile_path(str) – local file path that was uploadeddestination_path(str) – path on the node where file was placednode_id(str) – target node ID
Examples
Upload to the default directory:
result = client.upload(
node_id,
file_path="./data.csv"
)
print(f"File uploaded to: {result.destination_path}")
# Output: /home/ubuntu/Desktop/MY_FILES/data.csvUpload to a custom directory:
result = client.upload(
node_id,
file_path="./script.py",
destination_path="/projects/scripts"
)
print(f"File uploaded to: {result.destination_path}")
# Output: /home/ubuntu/projects/scripts/script.pyExceptions
FileNotFoundErrorMissingCredentialsExceptionInstanceNotReadyExceptionInvalidRequestParametersExceptionInvalidDestinationPathExceptionTransferFailedExceptionInternalServerErrorException