.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.exceptions.SearxEngineAccessDeniedException Class Reference
+ Inheritance diagram for searx.exceptions.SearxEngineAccessDeniedException:
+ Collaboration diagram for searx.exceptions.SearxEngineAccessDeniedException:

Public Member Functions

 __init__ (self, int|None suspended_time=None, str message='Access denied')
 

Public Attributes

 suspended_time = suspended_time
 
 message = message
 

Static Public Attributes

str SUSPEND_TIME_SETTING = "search.suspended_times.SearxEngineAccessDenied"
 

Protected Member Functions

int _get_default_suspended_time (self)
 

Detailed Description

The website is blocking the access

Definition at line 58 of file exceptions.py.

Constructor & Destructor Documentation

◆ __init__()

searx.exceptions.SearxEngineAccessDeniedException.__init__ ( self,
int | None suspended_time = None,
str message = 'Access denied' )
Generic exception to raise when an engine denies access to the results.

:param suspended_time: How long the engine is going to be suspended in
    second. Defaults to None.
:type suspended_time: int, None
:param message: Internal message.  Defaults to ``Access denied``
:type message: str

Reimplemented in searx.exceptions.SearxEngineCaptchaException, and searx.exceptions.SearxEngineTooManyRequestsException.

Definition at line 65 of file exceptions.py.

65 def __init__(self, suspended_time: int | None = None, message: str = 'Access denied'):
66 """Generic exception to raise when an engine denies access to the results.
67
68 :param suspended_time: How long the engine is going to be suspended in
69 second. Defaults to None.
70 :type suspended_time: int, None
71 :param message: Internal message. Defaults to ``Access denied``
72 :type message: str
73 """
74 if suspended_time is None:
75 suspended_time = self._get_default_suspended_time()
76 super().__init__(message + ', suspended_time=' + str(suspended_time))
77 self.suspended_time = suspended_time
78 self.message = message
79

Member Function Documentation

◆ _get_default_suspended_time()

int searx.exceptions.SearxEngineAccessDeniedException._get_default_suspended_time ( self)
protected

Definition at line 80 of file exceptions.py.

80 def _get_default_suspended_time(self) -> int:
81 from searx import get_setting # pylint: disable=C0415
82
83 return get_setting(self.SUSPEND_TIME_SETTING)
84
85

Member Data Documentation

◆ message

searx.exceptions.SearxEngineAccessDeniedException.message = message

Definition at line 78 of file exceptions.py.

◆ SUSPEND_TIME_SETTING

searx.exceptions.SearxEngineAccessDeniedException.SUSPEND_TIME_SETTING = "search.suspended_times.SearxEngineAccessDenied"
static

Definition at line 61 of file exceptions.py.

◆ suspended_time

searx.exceptions.SearxEngineAccessDeniedException.suspended_time = suspended_time

Definition at line 77 of file exceptions.py.


The documentation for this class was generated from the following file: