From 82178b4c6ed29057d8fbb95427fb4ec98b5a67d9 Mon Sep 17 00:00:00 2001 From: Peter Vacho Date: Mon, 25 Nov 2024 10:58:54 +0100 Subject: [PATCH] Use a more readable name for cache files --- src/__main__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/__main__.py b/src/__main__.py index c98a603..f9283aa 100644 --- a/src/__main__.py +++ b/src/__main__.py @@ -29,7 +29,9 @@ async def main() -> None: start = perf_counter() # Construct a unique file-name for each URL & ALLOWED_HOSTS_RE combination - cache_file = CACHE_RESULTS_DIR / base64.b64encode((str(URL) + str(ALLOWED_HOSTS_RE)).encode("utf-8")).hex() + readable_prefix = str(URL).removeprefix("https://").removeprefix("http://").replace("/", "_") + unique_suffix = base64.b64encode((str(URL) + str(ALLOWED_HOSTS_RE)).encode("utf-8")).hex() + cache_file = CACHE_RESULTS_DIR / (readable_prefix + "-" + unique_suffix + ".csv") if cache_file.exists(): print("> Using cached urlmap dataframe")