Package metalparser.common¶
Subpackages¶
Module metalparser.common.exceptions¶
-
exception
metalparser.common.exceptions.MetalParserException(message='Error')[source]¶ Bases:
Exception
Module metalparser.common.logger¶
-
class
metalparser.common.logger.MetalParserLogger(debug_mode)[source]¶ Bases:
objectInstantiate a logging.Logger object.
- Parameters
debug_mode (bool) – Boolean defining if the logging level (DEBUG if True, ERROR if False).
-
logger¶ The logging.Logger object initialized.
- Type
Logger
-
get_logger()[source] Returns the logger attribute.
- Returns
[Logger] – The logging.Logger object initialized.
Module metalparser.common.scraping¶
-
class
metalparser.common.scraping.ScrapingAgent(use_cache=True)[source]¶ Bases:
objectInstantiate an object with cached and uncached web crawling functions.
- Parameters
use_cache (bool) – Boolean defining if a cached session will be created or not
-
cache_expires_after¶ Expiring time for cached contents
- Type
int
-
cached_session¶ Object instantiating a cached session for requests
- Type
CachedSession
-
get_page_from_url(self, url)[source]¶ Returns a DarkLyrics.com page related to an artist in form of a BeautifulSoup object.
-
get_last_response(self)[source]¶ Returns the last Response object corresponding to the last request made by the ScrapingAgent.
-
get_cached_session()[source] Returns the cached_session attribute.
- Returns
[CachedSession or None] – The CachedSession object instantiated when initializing the object class.
-
get_last_response()[source] Returns the last Response object corresponding to the last request made by the ScrapingAgent.
- Returns
[Response or None] – The Response object corresponding to the last request made by the ScrapingAgent.
-
get_page_from_url(url)[source] Returns a DarkLyrics.com page related to an artist in form of a BeautifulSoup object.
- Parameters
{str} -- A string containing an URL (url) –
- Returns
[BeautifulSoup] – An HTML page related to the specified URL in form of a BeautifulSoup object