Skip to content

Python and command-line utility for looking up scripture verses or converting scripture references between formats.

License

Notifications You must be signed in to change notification settings

samuelbradshaw/python-scripture-lookup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scripture Lookup

Scripture Lookup is a Python library and command-line tool for looking up scripture verses or chapters. It can also convert scripture references between formats and languages. The tool is built around data from Python Scripture Scraper.

Installation

The Python package and command-line tool can be installed from PyPI via pip:

pip install scripturelookup

Command-line usage

Pattern:

scripturelookup [command] [input] [options]

Examples:

% scripturelookup get_content "john 3:16" --lang "en"
16 ¶ For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life.

% scripturelookup get_label "니파이전서 3:7" --lang "fr" --abbreviated
1 Né 3:7

% scripturelookup get_church_url "helaman 5:12"
https://www.churchofjesuschrist.org/study/scriptures/bofm/hel/5?id=p12&lang=eng#p12

% scripturelookup get_label "/scriptures/nt/1-jn/3.2-3" --lang "cmn-Hant"
約翰一書3:2-3

% scripturelookup get_church_url "/scriptures/ot" --lang "es"
https://www.churchofjesuschrist.org/study/scriptures/ot?lang=spa

Python usage

Examples:

from scripturelookup import lookup

lookup.get_content('john 3:16', lang = 'en')
# 16 ¶ For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life.

lookup.get_label('니파이전서 3:7', lang = 'fr', abbreviated = True)
# 1 Né 3:7

lookup.get_church_url('helaman 5:12')
# https://www.churchofjesuschrist.org/study/scriptures/bofm/hel/5?id=p12&lang=eng#p12

lookup.get_label('/scriptures/nt/1-jn/3.2-3', lang = 'cmn-Hant')
# 約翰一書3:2-3

lookup.get_church_url('/scriptures/ot', lang = 'es')
# https://www.churchofjesuschrist.org/study/scriptures/ot?lang=spa

Commands, inputs, and options

Commands

  • get_content – Get chapter or verse content.
  • get_label – Get a scripture reference label (i.e. "John 3:16").
  • get_church_uri – Get a Gospel Library URI (i.e. "/scriptures/bofm/hel/5.12").
  • get_church_url – Get a Gospel Library URL.
  • get_church_link – Get an HTML link to Gospel Library.

Inputs

Any of the following input types are supported. You can also provide several inputs at once as a list (separated by semicolons or line-breaks).

Options

Several options are available. Some are only applicable to certain commands.

  • lang (optional) – Output language. BCP 47 language codes and Gospel Library language codes are supported. Default: 'en'.
  • separator (optional) – String separator between outputs when a list of references is being requested. Default: '\n'.
  • source (optional) – Content source. Default: 'python-scripture-scraper'. Supported values: 'python-scripture-scraper' or 'ChurchofJesusChrist.org'.
  • link_class (optional) – String for the “class” attribute on links. Default: None.
  • link_target (optional) – String for the “target” attribute on links. Default: None.
  • use_query_parameters (optional) – Whether query parameters should be used on URIs. Default: False.
  • skip_lang (optional) – Whether “lang” query parameters should be skipped on URLs. Default: False.
  • skip_fragment (optional) – Whether fragments should be skipped on URLs. Default: False.
  • skip_book_name (optional) – Whether book names should be skipped on labels. Default: False.
  • abbreviated (optional) – Whether book abbrevions should be used on labels. Default: False.

Acknowledgements

Python Scripture Scraper – tool for scraping scripture content and metadata from ChurchofJesusChrist.org. geezify-python – tool for converting numbers to and from Geez numerals.