Coder Social home page Coder Social logo

mawaqit-py's Introduction

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(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.
  • 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 [email protected].

May Allah reward you!

mawaqit-py's People

Contributors

ibrahim-zehhaf-mawaqit avatar moha-tah avatar thenordine avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.