summaryrefslogtreecommitdiff
path: root/searx/metrics/error_recorder.py
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2021-09-17 11:48:37 +0200
committerGitHub <noreply@github.com>2021-09-17 11:48:37 +0200
commitdc74df3a550f48152eb30c0da4837b0de83420e2 (patch)
tree3f2dd22a72468e5fa0901a0339ae810b1fa28af6 /searx/metrics/error_recorder.py
parent0d9959e649c9625c3264382698b49ec6b99096f0 (diff)
parent41f6359d06fd6fb93ddfde59cba17da57565f587 (diff)
Merge pull request #261 from dalf/upgrade_httpx
[upd] upgrade httpx 0.19.0
Diffstat (limited to 'searx/metrics/error_recorder.py')
-rw-r--r--searx/metrics/error_recorder.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/searx/metrics/error_recorder.py b/searx/metrics/error_recorder.py
index 6963cda2f..37594e5e8 100644
--- a/searx/metrics/error_recorder.py
+++ b/searx/metrics/error_recorder.py
@@ -74,9 +74,11 @@ def get_request_exception_messages(exc: HTTPError)\
status_code = None
reason = None
hostname = None
- if hasattr(exc, 'request') and exc.request is not None:
+ if hasattr(exc, '_request') and exc._request is not None:
+ # exc.request is property that raise an RuntimeException
+ # if exc._request is not defined.
url = exc.request.url
- if url is None and hasattr(exc, 'response') and exc.respones is not None:
+ if url is None and hasattr(exc, 'response') and exc.response is not None:
url = exc.response.url
if url is not None:
hostname = url.host