"""S3 connector.""" import boto3 import config def full_path(object_name: str) -> str: """Generate full s3 path to save into the database. Args: object_name (str): File name generated for the invoice Returns: str: full s3 path to the specified object """ object_name = object_name.lstrip('/') return f's3://{config.S3_BUCKET}/{object_name}' def upload_file(file_path: str, object_name: str) -> None: """Upload a local file to S3. Args: file_path (str): Path to the local file object_name (str): Name of the object to upload """ s3_client = boto3.client('s3') s3_client.upload_file(file_path, config.S3_BUCKET, object_name)