This API provides access to duas (supplications) from the book "Hisnul Muslim" (Fortress of the Muslim). It allows users to retrieve duas organized by chapters, access all duas at once, or get a random dua daily.
- Retrieve all duas
- Get duas for a specific chapter
- Get a random dua daily
- Rate limiting to prevent abuse
- Error handling for common HTTP status codes
-
Bismillah
-
Clone the repository:
git clone https://github.com/imranye/hisnul-muslim-api.git cd hisnul-muslim-api -
Create a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate` -
Install the required dependencies:
pip install -r requirements.txt
-
Start the Flask application:
python app.py -
The API will be available at
http://localhost:5000/api/v1/
GET /api/v1/duas: Retrieve all duasGET /api/v1/duas/<chapter_id>: Retrieve duas for a specific chapterGET /api/v1/duadaily: Retrieve a random dua (inspired by duadaily.fyi)
The API implements rate limiting to prevent abuse:
- 200 requests per day for all endpoints
- 50 requests per hour for all endpoints
- 100 requests per day for the
/api/v1/duasendpoint - 200 requests per day for the
/api/v1/duas/<chapter_id>endpoint - 200 requests per day for the
/api/v1/duadailyendpoint
The API handles common HTTP status codes:
- 404: Not Found
- 429: Rate Limit Exceeded
- 500: Internal Server Error
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
The API is also publicly hosted. You can access the deployed version at https://hisnulmuslimapi-94ff7d621ce8.herokuapp.com/.
Here are the curl commands to interact with the deployed API:
-
Get All Duas:
curl -X GET https://hisnulmuslimapi-94ff7d621ce8.herokuapp.com/api/v1/duas -
Get Duas for a Specific Chapter (replace
<chapter_id>with the actual chapter ID):curl -X GET https://hisnulmuslimapi-94ff7d621ce8.herokuapp.com/api/v1/duas/<chapter_id> -
Get a Specific Dua from a Specific Chapter (replace
<chapter_id>and<dua_id>with the actual chapter ID and dua ID):curl -X GET https://hisnulmuslimapi-94ff7d621ce8.herokuapp.com/api/v1/duas/<chapter_id>/<dua_id> -
Get Dua of the Day:
curl -X GET https://hisnulmuslimapi-94ff7d621ce8.herokuapp.com/api/v1/duadaily
These commands will help you test the different endpoints of the publicly hosted API.