Git Product home page Git Product logo

waktusolat-fetcher's Introduction

Waktu Solat fetcher (Malaysia)

Simple CLI utility to fetch prayer time data from JAKIM.

๐Ÿšง This is still work-in-progress ๐Ÿšง Related to mptwaktusolat/api-waktusolat#3

Get Started (Development)

  1. Clone this repository
  2. Install dependencies
    pip install -r requirements.txt
  3. Run the script
    py main.py

Usage

To view all available commands, run:

py main.py -h

To view help for specific command, run:

py main.py <command> -h

fetch

Step 1: This command will fetch the prayer time data for all states for the current month (default). If you want to fetch for other month, you can pass the --relative-month arguments (accepts integer input). A file month-year.json will be produced.

Step 2: Next, the date time will be parsed and save as UNIX timestamp (seconds). Another output file will be produced (month-year.processed.json).

Note All produced files will be saved in the output directory.

Step 3: Then, the processed data will be pushed to the Firebase Firestore. You can skip this step by passing the argument --no-push. (You may need to have Firebase admin credential JSON file)

waktusolat-fetcher's People

Contributors

iqfareez avatar

waktusolat-fetcher's Issues

Handle "NO_RECORD!" from JAKIM API

I'm attempting to get data for the next year (2024). I found out not all states have the data ready yet.

For example here, Johor have data for 2024 but Kedah not yet.

Johor:
image

Kedah:
image

I inspected the API for Kedah:

curl --request POST \
  --url 'https://www.e-solat.gov.my/index.php?r=esolatApi%2Ftakwimsolat&period=duration&zone=KDH05' \
  --header 'Accept: application/json, text/plain, */*' \
  --header 'content-type: multipart/form-data' \
  --cookie 'TS01ca5017=01714ff3614ef2170fc18d602d08eb51fe7ea050efd0a1f3f3efc019f7086c3b9237391e32727d2b1fd4c48270b2462400b8c466e0cce6993152b806b8ae49de4a7f93f10d99404f5b374ffbe81950ce95b432e1e4; PHPSESSID=l4g77jesk61cek0lqurqpmjsjv' \
  --form datestart=2024-01-01 \
  --form dateend=2024-01-01

It returned the status code 200, but with the message of NO_RECORD!. I think we need to handle this situation in the code. Maybe we can try to skip and record the states with no records instead of letting them failed.

image

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.