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
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.6.0.tar.gz (12.8 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.6.0-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: muslim_prayer_time-0.6.0.tar.gz
  • Upload date:
  • Size: 12.8 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.6.0.tar.gz
Algorithm Hash digest
SHA256 da6cb194e6862ab631f4f46f61b18af4f6103dea726373e8a886d39f74c213c3
MD5 9d70e9930898427389c55bca5658d064
BLAKE2b-256 fb97ee9d23f1c60c083365af2e327b37eb17ddb0db596ea05ab9391451f9bdef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for muslim_prayer_time-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2c3ad844b47724de2a77825b9f5fa8acc5665dee4e58d48b3d777d2031a6e17c
MD5 349680cdf6ad8262212a5b1b757dde4b
BLAKE2b-256 856b215a8c95b9d356cd64953f7209acefcbbaf606ecb2339e14f64ef14a675b

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