StorageService module¶
-
class
StorageService.
StorageService
¶ Bases:
abc.ABC
Abstract base class for cloud storage. It defines a generic interface to implement
-
abstract
downloadFile
(bucket: str, key: str, filename: str)¶ Interface to download a file from the storage provider
- Parameters
bucket (str) – The S3 bucket to use
key (str) – The key for the file
filename (str) – The path and filename to save the file as
-
abstract
file_exists
(bucket: str, key: str)¶ Test if the specified file exists in the storage provider bucket
- Parameters
bucket (str) – The S3 bucket to use
key (str) – The S3 key for the file to check
- Returns
True if file exists False if file does not exist
- Return type
bool
-
abstract
uploadFile
(filename: str, bucket: str, key: str, public: bool = False)¶ Interface to upload a file to the storage provider
- Parameters
filename (str) – The path and filename to upload
bucket (str) – The S3 bucket to use
key (str) – The key to store the file as
public (bool) – If file should be made publicly accessible or not
-
abstract