Skip to main content

Python client for Deen API from Imaniro.com - Islamic resources API

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.0.0.tar.gz (5.8 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.0.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file deen_api_client-1.0.0.tar.gz.

File metadata

  • Download URL: deen_api_client-1.0.0.tar.gz
  • Upload date:
  • Size: 5.8 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.0.0.tar.gz
Algorithm Hash digest
SHA256 383ad1c19bdd667c3182e524e31bc5d3b794bdff726d34db6a896ebb312e4ec3
MD5 7776f1cbef30e2546deb8d5cbb15412e
BLAKE2b-256 e0844861bfde40fff0f7fa714c9a3e7f80fe1f815a1eff00523f2405b6f7946e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for deen_api_client-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dcdafe38c52e51f3f38856655a975dac3131af5e5d9c421c5d18285ca641152e
MD5 c0d9a84e621b1be8add22148df9b0a26
BLAKE2b-256 4ddaeeff206e2ba77a7142fbee0be39663619265f7672aaab3fb214c021aa76b

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