Welcome to versify’s documentation!

Installation of versify

From with pip

To install versify, simply run this simple command in your terminal of choice:

pip install versify

From source code

versify is developed on GitHub, where the code is always available.

You can either clone the public repository:

git https://github.com/willinprogress/python-versify.git

Or, download the tarball:

curl -OL https://github.com/willinprogress/python-versify/tarball/master

# optionally, zipball is also available (for Windows users).

Once you have a copy of the source, you can embed it in your own Python package, or install it into your site-packages easily:

cd python-versify
pip install .

Quickstart

Eager to get started? This page gives a good introduction in how to get started with versify.

First, make sure that:

  • Versify is installed
  • you have a file config.ini with this content:
[dbt]
key = myDbtKey
lang = FRN

Let’s get started with some simple examples.

Get a verse on bible

Get a verse with versify is very simple.

Begin by importing the versify module:

from versify.util.Dbt import Dbt

Now, let’s try to get a verse.

# locate the config.ini file
dbt = Dbt(config_path="/path/to/config.ini")

# DBY is the code of Darby
print(dbt.find_verse("DBY", "1 Timothée", 2, 1))

That’s all well and good, but it’s also only the start of what versify can do.

Get List of verse of chapters

You often want to get all the verse of chapter on bible. You would use the following code.

# locate the config.ini file
dbt = Dbt(config_path="/path/to/config.ini")

# DBY is the code of Darby
print(dbt.find_chapters("DBY", "1 Timothée", 2).get_verses(dbt))

Get random verse on bible

You often want to get a random verse on bible. You would use the following code.

# locate the config.ini file
dbt = Dbt(config_path="/path/to/config.ini")

# DBY is the code of Darby
print(dbt.get_random_verse("DBY"))

API Reference

Dbt

Wrapper implementation of Dbt API.

Usage:

>>> from versify import Dbt
>>> dbt = Dbt(config_path="/path/to/config.ini")
>>> print(dbt.find_verse("DBY", "1 Timothée", 2, 1))
class versify.util.Dbt.Dbt(config_path)[source]

This class implement a wrapper on API Dbt

find_book(vers, book_name)[source]

Find a book in bible :param vers: bible version instance :param book_name: name of book in string :return: Instance of book

find_chapter(version, book, chapter_number)[source]

Find a chapter object in book :param version: bible version instance :param book: book instance :param chapter_number: number of chapter :return: Instance of chapter

get_osis_code()[source]

Get the list of osis codes on Dbt :return: list of osis code on Dbt

get_random_verse(version)[source]

Get a random verse on bible :param version: text version of bible (DBY, etc.) :return: instance of Verse object

get_request(url, attempt=0)[source]

This function make get request on url with some attemps :param url: url to make your get request :param attempt: number of the current attempt :return: response object of get request

versify.util.Dbt.get_config(config_path)[source]

Get config data :param config_path: filepath of config ini file :return: instance of ini config file

versify.util.Dbt.levenshtein_distance(a, b)[source]

Return the Levenshtein edit distance between two strings a and b.

Indices and tables