Skip to main content

The official MAWAQIT Python wrapper.

Project description

MAWAQIT Python Library

‏السلام عليكم ورحمة الله وبركاته

Official async Python client for the MAWAQIT API — fetch mosque information and prayer times.

Getting an API token

  1. Create a free account on mawaqit.net.
  2. The client logs in with your email and password and obtains an API token for you (get_api_token()).
  3. Already have a token? Pass it directly with token=... and skip the login.

Installation

pip install mawaqit

Usage

import asyncio
from mawaqit import AsyncMawaqitClient


async def main():
    client = AsyncMawaqitClient(
        username=USERNAME, password=PASSWORD, latitude=LATITUDE, longitude=LONGITUDE
    )
    await client.get_api_token()

    # Find mosques near the coordinates, then pick one:
    mosques = await client.all_mosques_neighborhood()
    client.mosque = mosques[0]["uuid"]
    # Or search by keyword: await client.fetch_mosques_by_keyword("paris")

    print(await client.fetch_prayer_times())
    await client.close()


asyncio.run(main())

Full example: examples/async_example.py.

Exceptions

All inherit from MawaqitException:

  • BadCredentialsException — wrong login credentials.
  • MissingCredentials — required credentials not provided.
  • NoMosqueAround — no mosque near the given location.
  • NoMosqueFound — no mosque matches the keyword.
  • NotFoundException — resource not found.

Contributing

Fork the repo and open a pull request, or open an issue.

pip install -r requirements-test.txt   # dev dependencies
ruff check . && ruff format --check .   # lint + format
mypy                                    # type check
pytest                                  # tests (must stay at 100% coverage)
pytest tests/test_client.py::test_keyword_success --no-cov   # a single test

Enable the pre-push hook to run lint, type checks, and tests before each push:

git config core.hooksPath .githooks

HTTP is tested with an injected fake session (see tests/test_client.py), not by mocking aiohttp — follow that pattern for new tests.

License

Released under the license in the LICENSE file.

Questions

Reach us at support@mawaqit.net. May Allah reward you!

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-1.0.13.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

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

mawaqit-1.0.13-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file mawaqit-1.0.13.tar.gz.

File metadata

  • Download URL: mawaqit-1.0.13.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mawaqit-1.0.13.tar.gz
Algorithm Hash digest
SHA256 b40e351123c5e7eff1efa60d6a3bbd18b2ede2d18c61e87595318a725b80ddf3
MD5 d4d969c37bdc140b59257ba03d814eaa
BLAKE2b-256 1ccabc6c18d116eb2d45bc0761028e457c51f523aee28b958943c9139d1b68b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for mawaqit-1.0.13.tar.gz:

Publisher: python-publish.yml on mawaqit/mawaqit-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mawaqit-1.0.13-py3-none-any.whl.

File metadata

  • Download URL: mawaqit-1.0.13-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mawaqit-1.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 d5865d5b34f6a9ffc7525ba85bd3db355e09c0959e7efeea58b0e90b0b8c3b64
MD5 e0ac77382e69b46156f98911c2c3f3bc
BLAKE2b-256 50e75d5389fe958dfd0b5e91ad80e71d61ea7939ff402487c35c49d9cc25096d

See more details on using hashes here.

Provenance

The following attestation bundles were made for mawaqit-1.0.13-py3-none-any.whl:

Publisher: python-publish.yml on mawaqit/mawaqit-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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