https://github.com/abdulrcs/daily-prayer-time-api
It’s an easy to use API to get today’s prayer time based on Muslim Pro 🌙
https://github.com/abdulrcs/daily-prayer-time-api
api beautiful-soup prayer-times
Last synced: 4 days ago
JSON representation
It’s an easy to use API to get today’s prayer time based on Muslim Pro 🌙
- Host: GitHub
- URL: https://github.com/abdulrcs/daily-prayer-time-api
- Owner: abdulrcs
- Created: 2021-01-17T05:37:54.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-03-11T15:26:35.000Z (over 1 year ago)
- Last Synced: 2025-04-02T05:46:19.080Z (7 months ago)
- Topics: api, beautiful-soup, prayer-times
- Language: Python
- Homepage:
- Size: 17.6 KB
- Stars: 89
- Watchers: 2
- Forks: 18
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Daily Prayer Time API 🌙
![]()
It's an easy to use API to get today's (and tomorrow!) prayer time for your next project! (based on **Muslim Pro**)
Written in Python using _Flask, Beautiful Soup, and duckduckgo_search_.
### Example Response:
```json
{
"city": "Mecca",
"date": "25 March 2024",
"today": {
"Fajr": "05:04",
"Sunrise": "06:20",
"Dhuhr": "12:27",
"Asr": "15:52",
"Maghrib": "18:34",
"Isha'a": "20:04"
},
"tomorrow": {
"Date": "Fri 26 Mar",
"Fajr": "05:03",
"Sunrise": "06:19",
"Dhuhr": "12:27",
"Asr": "15:52",
"Maghrib": "18:34",
"Isha'a": "20:04"
}
}
```
## Get Started
To use the API, you can simply fetch the data using the public API in
https://dailyprayer.abdulrcs.repl.co/api/ (City Name)> note: currently the `dailyprayer.abdulrcs.repl.co/api/` doesn't work since Repl.it has migrated it's link to a new one
> but you can always still fork the repo, spin up the main.py yourself, and self-host the Daily Prayer Time API yourself :)## Here's an example 😉
### Print the Data in Python:
```python
import requests
import jsonurl = "https://dailyprayer.abdulrcs.repl.co/api/singapore"
response = requests.get(url)
data = response.json()
print(data['city'])
print(data['date'])
for prayer in data["today"]:
print(prayer + ": " + data["today"][prayer])
# If you want to request for tomorrow prayer's time:
# for prayer in data["tomorrow"]:
# print(prayer + ": " + data["tomorrow"][prayer])
```### Print the Data in Node.js:
```javascript
const https = require('https');
let url = "https://dailyprayer.abdulrcs.repl.co/api/singapore";https.get(url,(res) => {
let body = "";res.on("data", (chunk) => {
body += chunk;
});res.on("end", () => {
try {
let json = JSON.parse(body);
console.log(json["city"])
console.log(json["date"])
for(prayer in json["today"])
console.log(prayer + ": " + json["today"][prayer])
} catch (error) {
console.error(error.message);
};
});}).on("error", (error) => {
console.error(error.message);
});
```
### Output:
```
Singapore
17 January 2024
Fajr: 05:52
Sunrise: 07:14
Dhuhr: 13:17
Asr: 16:40
Maghrib: 19:17
Isha'a: 20:31
```