def upload_object(self, file_name, object_name, expiration_time): """ Upload a file to an S3 bucket :param file_name: :param object_name: :param expiration_time: :return: url as string of the presigned url """ try: key_prefix = str(uuid.uuid4()) self.s3.upload_file( file_name, self.bucket_name, f"{key_prefix}/{object_name}", ) return self.__generate_pre_signed_url( expiration_time, object_name, key_prefix ) except ClientError as client_error: logger.exception( NOT_AVAILABLE, client_error, ) raise InternalServerError(NOT_AVAILABLE)