Module search_me.exceptions
Expand source code
# -*- coding: utf-8 -*-
__all__ = (
"SearchEngineRequestError", "SearchEngineAccessError",
"SearchEngineFormatError", "SearchEngineParamsError"
)
class SearchEngineException(Exception):
"""Search Engine Exception
"""
class SearchEngineRequestError(SearchEngineException):
"""Search Engine Request Error
"""
def __init__(self, *args):
"""Unpack args and call parent method
"""
super().__init__(*args)
self.domain = args[0]
self.status_code = args[1]
def __str__(self):
"""Str method
Returns
-------
str
String representation
"""
return f"Bad request: {self.domain}. Status code: {self.status_code}"
class SearchEngineAccessError(Exception):
"""Search Engine Access Error
"""
def __str__(self):
"""Str method
Returns
-------
str
String representation
"""
return "No access to attr"
class SearchEngineFormatError(Exception):
"""Search Engine Format Error
"""
def __init__(self, *args):
"""Unpack args and call parent method
"""
super().__init__(*args)
self.format = args[0]
def __str__(self):
"""Str method
Returns
-------
str
String representation
"""
return f"Can't handle format {self.format}"
class SearchEngineParamsError(Exception):
"""Search Engine Params Error
"""
def __init__(self, *args):
"""Unpack args and call parent method
"""
super().__init__(*args)
self.params = args[0]
def __str__(self):
"""Str method
Returns
-------
str
String representation
"""
return f"Set up params {self.params}"
class ApiError(Exception):
"""Api Error
"""
def __str__(self):
"""Str method
Returns
-------
str
String representation
"""
return "Provide valid API key"
Classes
class SearchEngineAccessError (*args, **kwargs)
-
Search Engine Access Error
Expand source code
class SearchEngineAccessError(Exception): """Search Engine Access Error """ def __str__(self): """Str method Returns ------- str String representation """ return "No access to attr"
Ancestors
- builtins.Exception
- builtins.BaseException
class SearchEngineFormatError (*args)
-
Search Engine Format Error
Unpack args and call parent method
Expand source code
class SearchEngineFormatError(Exception): """Search Engine Format Error """ def __init__(self, *args): """Unpack args and call parent method """ super().__init__(*args) self.format = args[0] def __str__(self): """Str method Returns ------- str String representation """ return f"Can't handle format {self.format}"
Ancestors
- builtins.Exception
- builtins.BaseException
class SearchEngineParamsError (*args)
-
Search Engine Params Error
Unpack args and call parent method
Expand source code
class SearchEngineParamsError(Exception): """Search Engine Params Error """ def __init__(self, *args): """Unpack args and call parent method """ super().__init__(*args) self.params = args[0] def __str__(self): """Str method Returns ------- str String representation """ return f"Set up params {self.params}"
Ancestors
- builtins.Exception
- builtins.BaseException
class SearchEngineRequestError (*args)
-
Search Engine Request Error
Unpack args and call parent method
Expand source code
class SearchEngineRequestError(SearchEngineException): """Search Engine Request Error """ def __init__(self, *args): """Unpack args and call parent method """ super().__init__(*args) self.domain = args[0] self.status_code = args[1] def __str__(self): """Str method Returns ------- str String representation """ return f"Bad request: {self.domain}. Status code: {self.status_code}"
Ancestors
- search_me.exceptions.SearchEngineException
- builtins.Exception
- builtins.BaseException