Python client for Deen API from Imaniro- Access authentic hadith collections.
Project description
Deen API Python Client
A Python client for the Deen API, providing easy access to Islamic resources including Hadith, Quran verses, and Duas.
Installation
pip install deen-api-client
Quick Start
from deen_api import ImaniroDeenAPIClient
# Initialize client with your API key
client = ImaniroDeenAPIClient(api_key="sk_12345")
# Get hadiths from Sahih al-Bukhari
hadiths = client.get_hadiths(book="Sahih al-Bukhari", max_limits=5)
for hadith in hadiths:
print(f"Book: {hadith.book}")
print(f"Chapter: {hadith.chapter}")
print(f"Text: {hadith.text}")
print(f"Translation: {hadith.translation}")
print("---")
# Get Quran verses
verses = client.get_quran_verses(surah="Al-Fatiha", max_limits=3)
# Get Duas
duas = client.get_duas(category="morning", max_limits=5)
Features
-
Hadith Access: Retrieve hadiths from various books
-
Quran Verses: Access Quranic verses with translations(under development)
-
Islamic Duas: Get supplications for various occasions(under development)
-
Error Handling: Comprehensive exception handling
Error Handling
The client provides specific exception types:
from deen_api import AuthenticationError, RateLimitError, NotFoundError
try:
hadiths = client.get_hadiths(book="Sahih al-Bukhari")
except AuthenticationError:
print("Invalid API key")
except RateLimitError:
print("Rate limit exceeded")
except NotFoundError:
print("Resource not found")
Example Usage Files
examples/hadith_example.py
from deen_api import ImaniroDeenAPIClient
def hadith_example():
client = ImaniroDeenAPIClient(api_key="sk_12345")
try:
# Get hadiths from Sahih al-Bukhari
hadiths = client.get_hadiths(book="Sahih al-Bukhari", max_limits=3)
print("Hadiths from Sahih al-Bukhari:")
for i, hadith in enumerate(hadiths, 1):
print(f"\n{i}. {hadith.hadith}")
print(f"Translation: {hadith.translation}")
print("-" * 50)
except Exception as e:
print(f"Error: {e}")
if __name__ == "__main__":
hadith_example()
Project details
Release history Release notifications | RSS feed
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 deen_api_client-1.1.0.tar.gz.
File metadata
- Download URL: deen_api_client-1.1.0.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a49866258e8773ab09c7e78a04a76249a5fae29c88ce0b5bc6a6b1fd18173c3a
|
|
| MD5 |
b2595c2afeacf951ad3459d4a29e26b1
|
|
| BLAKE2b-256 |
4f2421268abf84f4df632e0a300ee5838f74547e1e07091ab075934c7ec10c85
|
File details
Details for the file deen_api_client-1.1.0-py3-none-any.whl.
File metadata
- Download URL: deen_api_client-1.1.0-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab1cd24d1080d26bd372a99c5dcdb5d8befa9d13f58a12d360760fe1aa3ece5b
|
|
| MD5 |
4b7efc519286832e90deb1445f188e02
|
|
| BLAKE2b-256 |
30918db6ec2fde348dabc53d059a4b722544fa414f1cc560a9491ddfb1a6cfcc
|