download_from_s3

download_from_s3(s3_bucket, s3_key, path, client=None, client_kwargs=None, download_file_kwargs=None, force=True, clean_on_failure=True)[source]

Download a file from S3.

Parameters:
  • s3_bucket (str) – The key inside the S3 bucket name

  • s3_key (str) – The key inside the S3 bucket

  • path (Union[str, Path]) – The place to write the file

  • client (Optional[botocore.client.BaseClient]) – A botocore client. If none given, one will be created automatically

  • client_kwargs (Optional[Mapping[str, Any]]) – Keyword arguments to be passed to the client on instantiation.

  • download_file_kwargs (Optional[Mapping[str, Any]]) – Keyword arguments to be passed to boto3.s3.transfer.S3Transfer.download_file()

  • force (bool) – If false and the file already exists, will not re-download.

  • clean_on_failure (bool) – If true, will delete the file on any exception raised during download

Raises:
  • Exception – Thrown if an error besides a keyboard interrupt is thrown during download

  • KeyboardInterrupt – If a keyboard interrupt is thrown during download

  • UnexpectedDirectory – If a directory is given for the path argument

Return type:

None