"""Connector for AWS S3.""" import boto3 def get_s3_client(): """Get s3 client.""" return boto3.client('s3') def create_presigned_url(client, bucket, key, expiration=10): """Generate a temporary presigned url. Args: client (boto3.S3Client): The s3 client. bucket (str): Name of s3 bucket. key (srt): Name of existing s3 object key. expiration (int): Number of seconds the url is valid. Defaults to ten seconds. Returns: str: Presigned url. """ return client.generate_presigned_url( ClientMethod='get_object', ExpiresIn=expiration, Params={'Bucket': bucket, 'Key': key}, )