FileTransfer#

class ansys.speos.core.generic.file_transfer.FileTransfer(speos_client)#

Class to help performing file(s) transfer.

Parameters:
speos_clientansys.speos.core.kernel.client.SpeosClient

The Speos instance client.

Parameters:

speos_client (ansys.speos.core.kernel.client.SpeosClient)

Overview#

upload_file

Upload a file to a server.

upload_folder

Upload several files to a server.

download_file

Download a file from a server.

download_folder

Download several files from a server.

reserve

Reserve an uri.

delete

Delete a file from a server.

Import detail#

from ansys.speos.core.generic.file_transfer import FileTransfer

Method detail#

FileTransfer.upload_file(file_path, reserved_file_uri='')#

Upload a file to a server.

Parameters:
file_path: Path

File’s path to be uploaded.

reserved_file_uri: str, optional

Optional - In case an uri was already reserved in server for the file.

Returns:
ansys.api.speos.file.v1.file_transfer_pb2.Upload_Response

Object created from file_transfer.proto file, response of Upload procedure. Contains for example file uri and upload duration.

FileTransfer.upload_folder(folder_path, main_file_name, reserved_main_file_uri='')#

Upload several files to a server.

Parameters:
folder_path: Path

Folder’s path containing all files to upload.

main_file_name: str

Name of the file that will be considered as main. Other files will be dependencies of main.

reserved_main_file_uri: str, optional

Optional - In case an uri was already reserved in server for the main file.

Returns:
List[ansys.api.speos.file.v1.file_transfer_pb2.Upload_Response]

Object created from file_transfer.proto file, response of Upload procedure. Contains for example file uri and upload duration.

FileTransfer.download_file(file_uri, download_location)#

Download a file from a server.

Parameters:
file_uri: str

File’s uri on the server.

download_location: Path

Path of download location.

Returns:
ansys.api.speos.file.v1.file_transfer_pb2.Download_Response

Object created from file_transfer.proto file. Contains for example file uri, file name, file size and download duration.

FileTransfer.download_folder(main_file_uri, download_location)#

Download several files from a server.

Parameters:
main_file_uristr

Main file’s uri on the server - this file and all its dependencies will be downloaded.

download_locationPath

Path of download location.

Returns:
List[ansys.api.speos.file.v1.file_transfer_pb2.Download_Response]

Object created from file_transfer.proto file. Contains for example file uri, file name, file size and download duration.

FileTransfer.reserve()#

Reserve an uri.

Returns:
str

File’s uri reserved on the server.

FileTransfer.delete(file_uri)#

Delete a file from a server.

Parameters:
file_uri: str

File’s uri on the server.