From d44f6966c28ecfe87e9e9d7ae9c65382418db664 Mon Sep 17 00:00:00 2001 From: I-Al-Istannen Date: Mon, 24 May 2021 16:22:11 +0200 Subject: [PATCH] Log authentication attempts in HTTP crawler --- PFERD/crawl/http_crawler.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/PFERD/crawl/http_crawler.py b/PFERD/crawl/http_crawler.py index facc2ba..45f9df2 100644 --- a/PFERD/crawl/http_crawler.py +++ b/PFERD/crawl/http_crawler.py @@ -67,12 +67,18 @@ class HttpCrawler(Crawler): the request was made. This ensures that authentication is not performed needlessly. """ async with self._authentication_lock: + log.explain_topic("Authenticating") # Another thread successfully called authenticate in-between # We do not want to perform auth again, so we return here. We can # assume the other thread suceeded as authenticate will throw an error # if it failed and aborts the crawl process. if caller_auth_id != self._authentication_id: + log.explain( + "Authentication skipped due to auth id mismatch." + "A previous authentication beat us to the race." + ) return + log.explain("Calling crawler-specific authenticate") await self._authenticate() self._authentication_id += 1 # Saving the cookies after the first auth ensures we won't need to re-authenticate