s3_demo_2.py 251 B

123456789
  1. def download_file(file_name, bucket):
  2. """
  3. Function to download a given file from an S3 bucket
  4. """
  5. s3 = boto3.resource('s3')
  6. output = f"downloads/{file_name}"
  7. s3.Bucket(bucket).download_file(file_name, output)
  8. return output