http¶
The http module enables OpenLP to retrieve scripture from bible websites.
- class openlp.plugins.bibles.lib.http.BGExtract(proxy_url=None)[source]¶
Bases: openlp.core.common.registryproperties.RegistryProperties
Extract verses from BibleGateway
- get_bible_chapter(version, book_name, chapter)[source]¶
Access and decode Bibles via the BibleGateway website.
Parameters: - version – The version of the Bible like 31 for New International version.
- book_name – Name of the Book.
- chapter – Chapter number.
- class openlp.plugins.bibles.lib.http.BSExtract(proxy_url=None)[source]¶
Bases: openlp.core.common.registryproperties.RegistryProperties
Extract verses from Bibleserver.com
- get_bible_chapter(version, book_name, chapter)[source]¶
Access and decode bibles via Bibleserver mobile website
Parameters: - version – The version of the bible like NIV for New International Version
- book_name – Text name of bible book e.g. Genesis, 1. John, 1John or Offenbarung
- chapter – Chapter number
- class openlp.plugins.bibles.lib.http.CWExtract(proxy_url=None)[source]¶
Bases: openlp.core.common.registryproperties.RegistryProperties
Extract verses from CrossWalk/BibleStudyTools
- get_bible_chapter(version, book_name, chapter)[source]¶
Access and decode bibles via the Crosswalk website
Parameters: - version – The version of the Bible like niv for New International Version
- book_name – Text name of in english e.g. ‘gen’ for Genesis
- chapter – Chapter number
- class openlp.plugins.bibles.lib.http.HTTPBible(parent, **kwargs)[source]¶
Bases: openlp.plugins.bibles.lib.db.BibleDB, openlp.core.common.registryproperties.RegistryProperties
- do_import(bible_name=None)[source]¶
Run the import. This method overrides the parent class method. Returns True on success, False on failure.
- get_chapter_count(book)[source]¶
Return the number of chapters in a particular book.
Parameters: book – The book object to get the chapter count for.
- get_verse_count(book_id, chapter)[source]¶
Return the number of verses for the specified chapter and book.
Parameters: - book_id – The name of the book.
- chapter – The chapter whose verses are being counted.
- get_verses(reference_list, show_error=True)[source]¶
A reimplementation of the BibleDB.get_verses method, this one is specifically for web Bibles. It first checks to see if the particular chapter exists in the DB, and if not it pulls it from the web. If the chapter DOES exist, it simply pulls the verses from the DB using the ancestor method.
- reference_list
This is the list of references the media manager item wants. It is a list of tuples, with the following format:
(book_reference_id, chapter, start_verse, end_verse)
Therefore, when you are looking for multiple items, simply break them up into references like this, bundle them into a list. This function then runs through the list, and returns an amalgamated list of Verse objects. For example:
[('35', 1, 1, 1), ('35', 2, 2, 3)]
- openlp.plugins.bibles.lib.http.get_soup_for_bible_ref(reference_url, header=None, pre_parse_regex=None, pre_parse_substitute=None)[source]¶
Gets a webpage and returns a parsed and optionally cleaned soup or None.
Parameters: - reference_url – The URL to obtain the soup from.
- header – An optional HTTP header to pass to the bible web server.
- pre_parse_regex – A regular expression to run on the webpage. Allows manipulation of the webpage before passing to BeautifulSoup for parsing.
- pre_parse_substitute – The text to replace any matches to the regular expression with.