From 2e0e725bfb5b35f950d0afbd432d3bef879d9878 Mon Sep 17 00:00:00 2001 From: Terje Kvernes Date: Wed, 21 Feb 2024 13:17:56 +0100 Subject: [PATCH] Fix typo and squash _all_ whitespace. --- mreg_cli/utilities/api.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mreg_cli/utilities/api.py b/mreg_cli/utilities/api.py index 4a3276f1..9566a9fa 100644 --- a/mreg_cli/utilities/api.py +++ b/mreg_cli/utilities/api.py @@ -7,6 +7,7 @@ import json import logging import os +import re import sys from typing import TYPE_CHECKING, Any, Dict, List, NoReturn, Optional, Union, cast, overload from urllib.parse import urljoin @@ -52,11 +53,11 @@ def create_and_set_corrolation_id(suffix: str) -> str: :returns: The generated corrolation id. """ - suffix = suffix.replace(" ", "_") - corrolation_id = f"{uuid4()}-{suffix}" + suffix = re.sub(r"\s+", "_", suffix) + correlation_id = f"{uuid4()}-{suffix}" - session.headers.update({"X-Correlation-ID": corrolation_id}) - return corrolation_id + session.headers.update({"X-Correlation-ID": correlation_id}) + return correlation_id def set_file_permissions(f: str, mode: int) -> None: