Developer Interface

This page of the documentation will cover all methods and classes available to the developer.

Core Interface

class lassie.Lassie
__init__()

Instantiates an instance of Lassie.

fetch(url, open_graph=None, twitter_card=None, touch_icon=None, favicon=None, all_images=None, parser=None, handle_file_content=None, canonical=None)

Retrieves content from the specified url, parses it, and returns a beautifully crafted dictionary of important information about that web page.

Priority tree is as follows:
  1. Open Graph
  2. Twitter Card
  3. Other meta content (i.e. description, keywords)
Parameters:
  • url – URL to send a GET request to
  • open_graph (bool) – (optional) If True, filters web page content for Open Graph meta tags. The content of these properties have top priority on return values.
  • twitter_card (bool) – (optional) If True, filters web page content for Twitter Card meta tags
  • touch_icon (bool) – (optional) If True, retrieves Apple touch icons and includes them in the response images array
  • favicon (bool) – (optional) If True, retrieves any favicon images and includes them in the response images array
  • canonical (bool) – (optional) If True, retrieves canonical url from meta tags. Default: False
  • all_images (bool) – (optional) If True, retrieves images inside web pages body and includes them in the response images array. Default: False
  • parser (string) – (optional) String reference for the parser that BeautifulSoup will use
  • handle_file_content (bool) – (optional) If True, lassie will return a generic response when a file is fetched. Default: False

Exceptions

exception lassie.LassieError

Generic catch-all Exceptions