upload_file

ltdconveyor.s3.upload_file(local_path, bucket_path, bucket, metadata=None, acl=None, cache_control=None)

Upload a file to the S3 bucket.

This function uses the mimetypes module to guess and then set the Content-Type and Encoding-Type headers.

Parameters:
  • local_path (str) – Full path to a file on the local file system.

  • bucket_path (str) – Destination path (also known as the key name) of the file in the S3 bucket.

  • bucket (boto3 Bucket instance) – S3 bucket.

  • metadata (dict, optional) – Header metadata values. These keys will appear in headers as x-amz-meta-*.

  • acl (str, optional) – A pre-canned access control list. See https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl Default is None, mean that no ACL is applied to the object.

  • cache_control (str, optional) – The cache-control header value. For example, 'max-age=31536000'.

Return type:

None