Skip to main content

Accurate prayer times for Muslims by location and date.

Project description

muslim_prayer_time

Accurate prayer times for Muslims by location and date.

Install

pip install muslim_prayer_time

Flask Web App

pip install flask
python web_app.py

Then open http://127.0.0.1:5000.

Usage

from datetime import date
from muslim_prayer_time import get_prayer_times, get_prayer_times_by_location, get_prayer_times_by_city

# Riyadh example
pt = get_prayer_times(
    d=date(2025, 1, 15),
    latitude=24.7136,
    longitude=46.6753,
    timezone=3,
    method="MWL",
    asr_method="standard",
    high_latitude_rule="angle",
    altitude=0.0,
)

print(pt)
print(pt.fajr, pt.isha)

# By location name (requires a User-Agent and internet access)
pt2 = get_prayer_times_by_location(
    d=date(2025, 1, 15),
    location="Riyadh, Saudi Arabia",
    timezone=3,
    user_agent="muslim_prayer_time/0.4 (your_email@example.com)",
    email="your_email@example.com",
)
print(pt2)

# By city name (offline built-in database)
pt3 = get_prayer_times_by_city(
    d=date(2025, 1, 15),
    city="Riyadh",
    country="Saudi Arabia",
    method="MWL",
)
print(pt3)

Methods

Supported methods:

  • MWL
  • ISNA
  • Egypt
  • Makkah
  • UmmAlQura
  • Karachi
  • Tehran
  • Jafari
  • France
  • Russia
  • Singapore
  • Moonsighting

High Latitude Rules

  • angle
  • midnight
  • one_seventh

Notes

  • timezone is the local UTC offset (e.g., 3 for UTC+3).
  • altitude is meters above sea level; it slightly affects sunrise/sunset.
  • Makkah/UmmAlQura use Isha at 90 minutes after Maghrib; you can override via makkah_isha_offset_minutes (e.g., 120 in Ramadan).
  • Tehran Isha angle is not explicitly defined in the source table; this library uses the common 14° default.
  • Moonsighting uses 18°/18° angles here (seasonal adjustments are not included).
  • Built-in city database uses IANA timezones to account for DST when computing the offset.

العربية

مكتبة دقيقة لحساب مواقيت الصلاة حسب الموقع والتاريخ.

مثال سريع

from datetime import date
from muslim_prayer_time import get_prayer_times

pt = get_prayer_times(
    d=date(2025, 1, 15),
    latitude=24.7136,
    longitude=46.6753,
    timezone=3,
    method="UmmAlQura",
    asr_method="standard",
    high_latitude_rule="angle",
    altitude=0.0,
    makkah_isha_offset_minutes=120,  # رمضان
    adjustments={"fajr": 2, "isha": -1},  # تعديل بالدقائق
)
print(pt)

استخدام اسم الموقع فقط (Geocoding)

ملاحظة: يلزم توفير user_agent واضح واحترام حد الطلبات لخدمة Nominatim.

from datetime import date
from muslim_prayer_time import get_prayer_times_by_location

pt = get_prayer_times_by_location(
    d=date(2025, 1, 15),
    location="Riyadh, Saudi Arabia",
    timezone=3,
    user_agent="muslim_prayer_time/0.4 (your_email@example.com)",
    email="your_email@example.com",
)
print(pt)

استخدام اسم المدينة (بدون إنترنت)

from datetime import date
from muslim_prayer_time import get_prayer_times_by_city, list_cities

print(list_cities()[:10])  # عرض أول 10 مدن

pt = get_prayer_times_by_city(
    d=date(2025, 1, 15),
    city="الرياض",
    country="Saudi Arabia",
    method="UmmAlQura",
)
print(pt)

License

MIT

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

muslim_prayer_time-0.5.0.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

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

muslim_prayer_time-0.5.0-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file muslim_prayer_time-0.5.0.tar.gz.

File metadata

  • Download URL: muslim_prayer_time-0.5.0.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for muslim_prayer_time-0.5.0.tar.gz
Algorithm Hash digest
SHA256 b1fe12e6bcc7da4d9a54ccfac817bf4a252de896c72c2ced78e035427ba7ead8
MD5 4e2d396a1bf214c4a82be2f43134ef86
BLAKE2b-256 d65cfb954b2809f9d22a79d50d9ee0e8598dbb1564b5e46b8562e14324e30eb9

See more details on using hashes here.

File details

Details for the file muslim_prayer_time-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for muslim_prayer_time-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d81804dec86caa06479503cd228c72edc554ee9b0b244f0984da28997acfb24c
MD5 b85b92889cdf750415b2ae721d6dccce
BLAKE2b-256 4987286f996a60504b032185cc1aa754f2fb6c093eeeef07f790727b4535eb08

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