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.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52a964e389f79d1b9a93a55c4548c2c4f93dc36e6e37f686e88615c0f55a2f63
|
|
| MD5 |
c807dda29b4b4bac06fc90ab267b3aa1
|
|
| BLAKE2b-256 |
3c400d9c1cad40c41d8dc8576096d6f7539c5f0b5eafaad608f83c82709793c3
|
Provenance
The following attestation bundles were made for youversion-0.3.1.tar.gz:
Publisher:
publish.yml on PandaWhoCodes/youversion
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
youversion-0.3.1.tar.gz -
Subject digest:
52a964e389f79d1b9a93a55c4548c2c4f93dc36e6e37f686e88615c0f55a2f63 - Sigstore transparency entry: 868689197
- Sigstore integration time:
-
Permalink:
PandaWhoCodes/youversion@03d35d6d6abcd97fe2f448319f6bd74c8dd49427 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/PandaWhoCodes
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@03d35d6d6abcd97fe2f448319f6bd74c8dd49427 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f5d94f195e8b3c416b1bbc8cc111674352198aec74eb3a2b4a732f346a824f3
|
|
| MD5 |
783abce5f8e925cd90b8db6d78488f3f
|
|
| BLAKE2b-256 |
d25540dd9016129f2e7c59f906a41a2055a34df8f5a7656b8e33be89cf31db14
|
Provenance
The following attestation bundles were made for youversion-0.3.1-py3-none-any.whl:
Publisher:
publish.yml on PandaWhoCodes/youversion
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
youversion-0.3.1-py3-none-any.whl -
Subject digest:
9f5d94f195e8b3c416b1bbc8cc111674352198aec74eb3a2b4a732f346a824f3 - Sigstore transparency entry: 868689201
- Sigstore integration time:
-
Permalink:
PandaWhoCodes/youversion@03d35d6d6abcd97fe2f448319f6bd74c8dd49427 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/PandaWhoCodes
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@03d35d6d6abcd97fe2f448319f6bd74c8dd49427 -
Trigger Event:
push
-
Statement type: