pastebin - collaborative debugging tool
stupidbob307.kpaste.net RSS


bible
Posted by Anonymous on Fri 6th May 2011 20:56
raw | new post

  1. import urllib2, re
  2.  
  3. def get_passage(passage):
  4.         key = "06f2c9d3f664a01e"
  5.         passage = "+".join(passage.split())
  6.         options = ['include-short-copyright=0',
  7.                            'include-audio-link=0',
  8.                    'include-passage-horizontal-lines=0',
  9.                    'include-heading-horizontal-lines=0']
  10.         options = "&".join(options)
  11.         url = "http://www.esvapi.org/v2/rest/passageQuery?key=%s&%s&passage=%s" % (key,options,passage)
  12.         f = urllib2.urlopen(url)
  13.         data = f.read()
  14.         return data
  15.  
  16.  
  17. print get_passage("Genesis 1:50")
  18.  
  19. simple_passage = re.compile("""
  20.         (?P<book> [0-9]?[a-z]*\ ? [a-z]+)\
  21.         (?P<chapter> [0-9]+):
  22.         (?P<start_verse> [0-9]*)\-?
  23.         (?P<end_verse> [0-9]*)
  24. """, re.IGNORECASE | re.VERBOSE)
  25.  
  26. complex_passage = re.compile("""
  27.         (?P<book> [0-9]?[a-z]*\ ? [a-z]+)\
  28.         (?P<chapter> [0-9]+):
  29.         (?P<start_verse> [0-9]*)\-
  30.         (?P<second_chapter> [0-9]+):
  31.         (?P<end_verse> [0-9]+)
  32. """, re.IGNORECASE | re.VERBOSE)
  33.  
  34.  
  35. def replace_semicolon(passage):
  36.         passage = passage.split(";")
  37.         book = re.match(r"[0-9]?[A-Za-z]* ?[A-Za-z]+", passage[0]).group()
  38.         passage[1] = book + passage[1]
  39.         return passage
  40.  
  41.  
  42.  
  43. books = ["Genesis","Exodus","Leviticus","Numbers","Deuteronomy","Joshua","Judges","Ruth","1 Samuel","2 Samuel","1 Kings","2 Kings","1 Chronicles","2 Chronicles","Ezra","Nehemiah","Esther","Job","Psalm","Proverbs","Ecclesiastes","Song of Solomon","Isaiah","Jeremiah","Lamentations","Ezekiel","Daniel","Hosea","Joel","Amos","Obadiah","Jonah","Micah","Nahum","Habakkuk","Zephaniah","Haggai","Zechariah","Malachi","Matthew","Mark","Luke","John","Acts","Romans","1 Corinthians","2 Corinthians","Galatians","Ephesians","Philippians","Colossians","1 Thessalonians","2 Thessalonians","1 Timothy","2 Timothy","Titus","Philemon","Hebrews","James","1 Peter","2 Peter","1 John","2 John","3 John","Jude","Revelation" ]

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at