Package metalparser.common

Module metalparser.common.exceptions

exception metalparser.common.exceptions.ArtistNotFoundException(message='Error')[source]

Bases: metalparser.common.exceptions.MetalParserException

exception metalparser.common.exceptions.LyricsNotFoundException(message='Error')[source]

Bases: metalparser.common.exceptions.MetalParserException

exception metalparser.common.exceptions.MetalParserException(message='Error')[source]

Bases: Exception

exception metalparser.common.exceptions.SongsNotFoundException(message='Error')[source]

Bases: metalparser.common.exceptions.MetalParserException

Module metalparser.common.logger

class metalparser.common.logger.MetalParserLogger(debug_mode)[source]

Bases: object

Instantiate 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(self)[source]

Returns the logger attribute.

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: object

Instantiate 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_cached_session(self)[source]

Returns the cached_session attribute.

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