Skip to main content

Python SDK for YouVersion API

Project description

YouVersion Python SDK

The un-official Python SDK for the YouVersion API. Access Bible versions, books, chapters, verses, and passages programmatically.

PyPI version Python 3.11+

Getting Started

1. Get Your API Key

Request access to the YouVersion API at platform.youversion.com/.

2. Install the SDK

pip install youversion

Or with uv:

uv add youversion

3. Initialize the Client

from youversion import YouVersionClient

client = YouVersionClient(api_key="your-api-key")

4. Make Your First Request

from youversion import YouVersionClient, is_ok

with YouVersionClient(api_key="your-api-key") as client:
    result = client.get_passage(12, "JHN.3.16")

    if is_ok(result):
        passage = result.value
        print(f"{passage.reference}")
        print(passage.content)

Output:

John 3:16
For God so loved the world, that he gave his only begotten Son,
that whosoever believeth on him should not perish, but have eternal life.

5. Display Copyright

When displaying Bible content, you must include the appropriate copyright notice:

result = client.get_version(12)
if is_ok(result):
    version = result.value
    print(version.copyright_short)  # Display with content

Installation

pip

pip install youversion

uv

uv add youversion

Poetry

poetry add youversion

Configuration

from youversion import YouVersionClient

# Basic initialization
client = YouVersionClient(api_key="your-api-key")

# With custom settings
client = YouVersionClient(
    api_key="your-api-key",
    base_url="https://api.youversion.com",  # Default
    timeout=30.0,  # Request timeout in seconds
)

# Using context manager (recommended)
with YouVersionClient(api_key="your-api-key") as client:
    # Client automatically closes when done
    pass

Environment Variables

import os
from youversion import YouVersionClient

client = YouVersionClient(api_key=os.environ["YOUVERSION_API_KEY"])

Sync vs Async Clients

The SDK provides both synchronous and asynchronous clients with identical APIs.

Synchronous Client

Use YouVersionClient for synchronous code:

from youversion import YouVersionClient, is_ok

# With context manager (recommended)
with YouVersionClient(api_key="your-api-key") as client:
    result = client.get_versions("en")
    if is_ok(result):
        for version in result.value.data:
            print(version.title)

Asynchronous Client

Use AsyncYouVersionClient for async code:

import asyncio
from youversion import AsyncYouVersionClient, is_ok

async def main():
    async with AsyncYouVersionClient(api_key="your-api-key") as client:
        result = await client.get_versions("en")
        if is_ok(result):
            for version in result.value.data:
                print(version.title)

asyncio.run(main())

Manual Client Management

If you need more control over the client lifecycle, you can manage it manually instead of using context managers.

Sync Client (Manual)

from youversion import YouVersionClient, is_ok

client = YouVersionClient(api_key="your-api-key")

try:
    result = client.get_versions("en")
    if is_ok(result):
        print(f"Found {len(result.value.data)} versions")

    result = client.get_passage(12, "JHN.3.16")
    if is_ok(result):
        print(result.value.content)
finally:
    # Always close the client to release resources
    client.close()

Async Client (Manual)

import asyncio
from youversion import AsyncYouVersionClient, is_ok

async def main():
    client = AsyncYouVersionClient(api_key="your-api-key")

    try:
        result = await client.get_versions("en")
        if is_ok(result):
            print(f"Found {len(result.value.data)} versions")

        result = await client.get_passage(12, "JHN.3.16")
        if is_ok(result):
            print(result.value.content)
    finally:
        # Always close the client to release resources
        await client.close()

asyncio.run(main())

When to Use Manual Management

  • Connection pooling: Keep a client alive across multiple operations
  • Application lifecycle: Initialize once at startup, close at shutdown
  • Custom resource management: Integration with dependency injection or frameworks

Documentation

  • API Reference - Complete API documentation with all methods, types, and error handling

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

youversion-0.3.1.tar.gz (80.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

youversion-0.3.1-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file youversion-0.3.1.tar.gz.

File metadata

  • Download URL: youversion-0.3.1.tar.gz
  • Upload date:
  • Size: 80.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for youversion-0.3.1.tar.gz
Algorithm Hash digest
SHA256 52a964e389f79d1b9a93a55c4548c2c4f93dc36e6e37f686e88615c0f55a2f63
MD5 c807dda29b4b4bac06fc90ab267b3aa1
BLAKE2b-256 3c400d9c1cad40c41d8dc8576096d6f7539c5f0b5eafaad608f83c82709793c3

See more details on using hashes here.

Provenance

The following attestation bundles were made for youversion-0.3.1.tar.gz:

Publisher: publish.yml on PandaWhoCodes/youversion

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file youversion-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: youversion-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 17.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for youversion-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9f5d94f195e8b3c416b1bbc8cc111674352198aec74eb3a2b4a732f346a824f3
MD5 783abce5f8e925cd90b8db6d78488f3f
BLAKE2b-256 d25540dd9016129f2e7c59f906a41a2055a34df8f5a7656b8e33be89cf31db14

See more details on using hashes here.

Provenance

The following attestation bundles were made for youversion-0.3.1-py3-none-any.whl:

Publisher: publish.yml on PandaWhoCodes/youversion

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page