diff options
author | Alexandre Flament <alex@al-f.net> | 2023-01-28 10:24:14 +0000 |
---|---|---|
committer | Alexandre Flament <alex@al-f.net> | 2023-01-28 10:24:14 +0000 |
commit | 37addec69e4211aac6b2302c82cb5c5c7b1d5e04 (patch) | |
tree | 52ce990fd7903fe9ae5407274057153f62ab9654 /searx/exceptions.py | |
parent | 6b71721ce80948d72ad656620a35507b73fc55d4 (diff) | |
download | searxng-37addec69e4211aac6b2302c82cb5c5c7b1d5e04.tar.gz searxng-37addec69e4211aac6b2302c82cb5c5c7b1d5e04.zip |
search.suspended_time settings: bug fixes
* fix type in settings.yml: replace suspend_times by suspended_times
* always use delay defined in settings.yml:
* HTTP status 402 and 403: read the value from settings.yml instead of using the hardcoded value of 1 day.
* startpage engine: CAPTCHA suspend the engine for one day instead of one week
Diffstat (limited to 'searx/exceptions.py')
-rw-r--r-- | searx/exceptions.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/searx/exceptions.py b/searx/exceptions.py index af81bfb23..b11821b17 100644 --- a/searx/exceptions.py +++ b/searx/exceptions.py @@ -70,8 +70,15 @@ class SearxEngineAccessDeniedException(SearxEngineResponseException): """The website is blocking the access""" SUSPEND_TIME_SETTING = "search.suspended_times.SearxEngineAccessDenied" + """This settings contains the default suspended time""" - def __init__(self, suspended_time=None, message='Access denied'): + def __init__(self, suspended_time: int = None, message: str = 'Access denied'): + """Generic exception to raise when an engine denies access to the results + + Args: + suspended_time (int, optional): How long the engine is going to be suspended in second. Defaults to None. + message (str, optional): Internal message. Defaults to 'Access denied'. + """ suspended_time = suspended_time or self._get_default_suspended_time() super().__init__(message + ', suspended_time=' + str(suspended_time)) self.suspended_time = suspended_time |