Skip to main content

Python API wrapper for mawaqit.net, the mosque prayer-times platform. Search mosques, read today's times, and pull the full-year calendar and announcements. No auth, no scraping headaches.

Project description

pymawaqit

pymawaqit is a small Python client for mawaqit.net, the platform behind prayer times for 8000+ mosques worldwide. It wraps the public search API and the per-mosque confData blob, so you get clean typed objects for mosques, today's prayer times, iqama offsets, the full-year calendar, and announcements, without manual HTML parsing.

The search endpoint needs no authentication and already embeds today's prayer times in every result. The per-mosque year calendar and announcements are not exposed by the public API, so they are read from the confData blob on each mosque's web page.

Installation

pip install mawaqit-py

For local development:

uv sync
uv run python -m unittest discover -s tests

Quick Start

from pymawaqit import Mawaqit

with Mawaqit() as client:
    # Search by name or city
    for mosque in client.search("amsterdam"):
        print(mosque.name, mosque.times.prayers, "| Jumua:", mosque.jumua)

    # Nearest mosques to a coordinate
    nearest = client.nearby(48.8566, 2.3522)
    print(nearest[0].name, nearest[0].coordinates)

    # Full-year calendar for a specific mosque (by slug or Mosque object)
    calendar = client.calendar("grande-mosquee-de-paris")
    print("Jul 1:", calendar.day(7, 1).prayers)

    # Announcements
    for notice in client.announcements("grande-mosquee-de-paris"):
        print(notice.title, notice.start_date, "->", notice.end_date)

Prayer times

Each mosque carries today's six clock values in times. Index 1 is sunrise/shuruq, not a prayer, so PrayerTimes keeps it separate:

times = mosque.times
times.fajr, times.sunrise, times.dhuhr, times.asr, times.maghrib, times.isha
times.prayers          # {'fajr': ..., 'dhuhr': ..., 'asr': ..., 'maghrib': ..., 'isha': ...}
mosque.iqama_offsets   # {'fajr': '+10', 'dhuhr': '+10', ...}  minutes after the adhan

API

Mawaqit is the only object you construct. Its public methods:

Method Returns Description
search(word=None, *, lat=None, lon=None, page=1) list[Mosque] Search by text, or by coordinate (nearest first).
nearby(lat, lon, *, page=1) list[Mosque] Convenience wrapper for a coordinate search.
iter_search(word=None, *, lat=None, lon=None, start_page=1, max_pages=None) Iterator[Mosque] Page through results until one comes back empty.
conf_data(mosque, *, lang="en") ConfData The full confData blob: calendar, announcements, events.
calendar(mosque, *, lang="en") Calendar The full-year prayer-time calendar.
announcements(mosque, *, lang="en") list[Announcement] A mosque's current announcements.

mosque arguments accept a Mosque, a slug string, or a full mawaqit.net/{lang}/{slug} URL.

Every value object has .to_dict() (pass include_raw=True to keep the original payload), and the untouched response is always on .raw.

How it works

This library uses two public surfaces of mawaqit.net:

Endpoint Method Purpose
mawaqit.net/api/2.0/mosque/search?word= GET Search mosques by name/city, with today's times embedded.
mawaqit.net/api/2.0/mosque/search?lat=&lon= GET Nearest mosques to a coordinate.
mawaqit.net/{lang}/{slug} GET Mosque web page; embeds a confData JSON blob with the whole year's calendar and announcements.

The per-mosque mobile endpoints (mosque/{uuid}/times, mosque/{uuid}/calendar, favorite, statistic/mosque) live behind an Api-Access-Token and are not used here.

The request transport, browser-fingerprint impersonation, and retry handling are internal details. Normal users only construct Mawaqit() and call the public methods above.

Disclaimer

This is an unofficial library and is not affiliated with, authorized, maintained, sponsored, or endorsed by MAWAQIT or any of its affiliates. Use at your own risk.

This library only accesses publicly available mosque data through mawaqit.net's web API and pages. The APIs are undocumented and may change or break at any time. Please use it responsibly and avoid excessive requests that could burden MAWAQIT's infrastructure.

License

AGPL-3.0

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

mawaqit_py-0.1.0.tar.gz (40.0 kB view details)

Uploaded Source

Built Distribution

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

mawaqit_py-0.1.0-py3-none-any.whl (27.6 kB view details)

Uploaded Python 3

File details

Details for the file mawaqit_py-0.1.0.tar.gz.

File metadata

  • Download URL: mawaqit_py-0.1.0.tar.gz
  • Upload date:
  • Size: 40.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for mawaqit_py-0.1.0.tar.gz
Algorithm Hash digest
SHA256 569d1d04999f16418187639a3fe9679229c64adfb5efd43a061990ebbea6d8be
MD5 951413cb57da1905dca821b6b225320a
BLAKE2b-256 46aa88f8b22f2eb84aa2e6797dbcd1f128848ca53f7d897a1b5720eba5da2ee3

See more details on using hashes here.

File details

Details for the file mawaqit_py-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mawaqit_py-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 27.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for mawaqit_py-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 189e6f8e31428a24311988f6d97516b9f5ad5a95807c713120c4f78595c384d9
MD5 0dff321585e0d02346e3b89be7bc54b8
BLAKE2b-256 921ad0837e6eef70d7247f082fb6cb4713af9feafc692c926c584361f51b6100

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