"""S3 connector.""" from tempfile import NamedTemporaryFile import boto3 s3_client = boto3.client('s3') def download_file(account_id, bucket_name, file_path): """Download file from specified s3 bucket.""" file = NamedTemporaryFile(suffix='.xlsx', delete=False) s3_client.download_file( bucket_name, file_path, file.name, ExtraArgs={'ExpectedBucketOwner': account_id} ) return file.name