Skip to main content

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


Download files

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

Source Distribution

deen_api_client-1.1.0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

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

deen_api_client-1.1.0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

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

Hashes for deen_api_client-1.1.0.tar.gz
Algorithm Hash digest
SHA256 a49866258e8773ab09c7e78a04a76249a5fae29c88ce0b5bc6a6b1fd18173c3a
MD5 b2595c2afeacf951ad3459d4a29e26b1
BLAKE2b-256 4f2421268abf84f4df632e0a300ee5838f74547e1e07091ab075934c7ec10c85

See more details on using hashes here.

File details

Details for the file deen_api_client-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for deen_api_client-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ab1cd24d1080d26bd372a99c5dcdb5d8befa9d13f58a12d360760fe1aa3ece5b
MD5 4b7efc519286832e90deb1445f188e02
BLAKE2b-256 30918db6ec2fde348dabc53d059a4b722544fa414f1cc560a9491ddfb1a6cfcc

See more details on using hashes here.

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