S3Storage module

class S3Storage.S3Storage

Bases: cloudflow.services.StorageService.StorageService

Concrete implementation of the StorageService class

downloadFile(bucket: str, key: str, filename: str)

Download a file from S3

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

Raises

ClientError if unable to download file or file does not exist

file_exists(bucket: str, key: str) → bool

Test if the specified file exists in the S3 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

uploadFile(filename: str, bucket: str, key: str, public: bool = False)

Upload a file to S3

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

Raises

ClientError if unable to upload file