Skip to main content

The official MAWAQIT Python wrapper.

Project description

MAWAQIT Python Library

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

This is the official Python library to access the MAWAQIT API.

Installation

To use this Python library, you can install it via pip:

pip install mawaqit

Usage

Synchroneous version

TODO : Not made yet.

Asynchroneous version

Here's a simple example (with asyncio) on how to use this library. You can check the async_example.py file to copy this code.

import asyncio
from mawaqit import AsyncMawaqitClient


async def main():
   # Initialize the Mawaqit client:
    # You can pass the username and password as parameters,
    # or directly your valid MAWAQIT API token
    # You can also pass your location (latitude and longitude) as parameters to get the nearest mosques
    client = AsyncMawaqitClient(
        username=USERNAME, password=PASSWORD, longitude=LONGITUDE, latitude=LATITUDE
    )

    # Get your API token
    api_token = await client.get_api_token()

    # Get information of the 5 nearest mosques around the given position (long, lat)
    mosques = await client.all_mosques_neighborhood()

    # Set the mosque to use
    client.mosque = mosques[0]["uuid"]

    # Fetch the prayer times from client.mosque
    print(await client.fetch_prayer_times())

    # Get information of the mosques from the specified keyword
    mosques = await client.fetch_mosques_by_keyword("test_keyword")

    # Set the mosque to use
    client.mosque = mosques[0]["uuid"]

    # Fetch the prayer times from client.mosque
    print(await client.fetch_prayer_times())

    await client.close()

if __name__ == "__main__":
    asyncio.run(main())

Exceptions

  • NotAuthenticatedException: Raised when authentication fails.
  • BadCredentialsException: Raised when login credentials are incorrect.
  • NoMosqueAround: Raised when no mosques are found around the specified location.
  • NoMosqueFound: Raised when no mosques are found using the specified keyword.
  • MissingCredentials: Raised when required credentials are not provided.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

If you want to contribute to this project, feel free to fork it and submit a pull request.

You can also open an issue if you find any bug or have any suggestion.

Questions

If you have any question, feel free to contact 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.9.tar.gz (5.2 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.9-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mawaqit-1.0.9.tar.gz
  • Upload date:
  • Size: 5.2 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.9.tar.gz
Algorithm Hash digest
SHA256 5ce488ab60a5af487cc7a8963f4562adc1602017c9b09b6207d453a4a9082f0c
MD5 dc4cd9d4369c576e7497f80bd04e70d8
BLAKE2b-256 5b2aaa3d83237d28ce4d9564eaa572214a5543fbb6ba2e65f9f5f39bc3c0b0d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for mawaqit-1.0.9.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.9-py3-none-any.whl.

File metadata

  • Download URL: mawaqit-1.0.9-py3-none-any.whl
  • Upload date:
  • Size: 6.0 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.9-py3-none-any.whl
Algorithm Hash digest
SHA256 c54b4cf86f162d7d6d1fd02163932a336b79007506bd339f1281c30ffa530e20
MD5 bcae98c3a979855440fc2a2f882517a8
BLAKE2b-256 7b31292713823fb138286e70c7f6212c3023bfbd509515335e25af3ddf4ef151

See more details on using hashes here.

Provenance

The following attestation bundles were made for mawaqit-1.0.9-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