Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

mptwaktusolat/mpt-backup-api

 
 

Repository files navigation

Python NodeJS GitHub Actions Heroku

mpt-backup-api

Announcement: This repo will be discountinued. Please visit the replacement repo mpt-server

Attention ❗ This API is meant to be used by the Malaysia Prayer Time app as a backup if JAKIM's API is unreachable.

To run

Pull the latest data from JAKIM.

Prerequisites: Node & Python 3.10

⚠️ Careful: Don't run too much (Don't DDOS JAKIM). For each run, it will poll this data from JAKIM server about 58 times (number of zones, it could be more than that due to retrying) every 1.5 secs.

Install required packages

pip install requests urllib3

Run the fetcher

py fetcher.py

Start local server

npm install

Then

npm start

Put it togother, how does it works?

flowchart TD
    A{{JAKIM API}}
    A <--> C
    C[[Fetch latest prayer data]] --- D[(db.json)] & E[(log.json)] --> F(Commit & push)
    F -->|Heroku build triggered| G[Deployed to Heroku]
Loading

This workflow will trigger automatically on the first day of the month via GitHub Actions.

api fetcher

References

  1. The idea behind automatic fetching and deploy using Python and GitHub
  2. The idea of this simple API architecture
  3. Website template

Languages

  • HTML 67.6%
  • Python 17.0%
  • JavaScript 15.4%