Use a more readable name for cache files

This commit is contained in:
Peter Vacho 2024-11-25 10:58:54 +01:00
parent ea03f0cf75
commit 82178b4c6e
Signed by: school
GPG key ID: 8CFC3837052871B4

View file

@ -29,7 +29,9 @@ async def main() -> None:
start = perf_counter() start = perf_counter()
# Construct a unique file-name for each URL & ALLOWED_HOSTS_RE combination # 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(): if cache_file.exists():
print("> Using cached urlmap dataframe") print("> Using cached urlmap dataframe")