Skip to main content

A library for retrieving data from The London Unified Prayer Timetable.

Project description

London Unified Prayer Times

image

image1

Documentation Status

A library for retrieving data from The London Unified Prayer Timetable.

What is this?

Mainly a Python library to retrieve, store and update a local prayer timetable for the London region using a format that happens to feed https://www.eastlondonmosque.org.uk.

Also provided is a command line utility to manage and query the timetable.

Features

The library can:

  • Retrieve and manage a local copy of the London Unified Prayer Timetable

  • Query the local copy of the timetable

Once initialised, the cli can:

  • Show the times for a day

  • Show the times for a month in calendar format

  • Show the current and next prayer time in relative formats

Installing

pip install london-unified-prayer-times

Alternatively Arch users can install via the AUR at: https://aur.archlinux.org/packages/python-london-unified-prayer-times/

FAQ

This doesn’t work! Why’s it asking for a URL?

This library is designed to download timetable data held in HTML format and accessible via a URL. It’s up to the user of the library to provide that URL. There is at least one such URL in the public domain, but that address isn’t provided here.

And yes, this technically means that anyone can craft an online dataset of custom times and have it accessible with this library. If you do, I’d love to hear about it.

How do you use the CLI tool?

The tool uses the click library, so passing –help everywhere should give some guidance on usage. Hint: you have to init first.

Honestly, I don’t expect many to use this and so documentation is a little… lacking. As with all great programmers, I believe the tool to make sense out of the box. You can drop me a line if you get stuck - eventually that will form the documentation.

Why not just use on of the many Prayer Time libraries available on PyPi?

In short, because they won’t output London Unified Prayer Times.

Most prayer time libraries (Python or otherwise), either directly use the amazing work of Hamid Zarrabi-Zadeh presented at http://praytimes.org/calculation or indirectly by wrapping https://aladhan.com/. On the other hand, ELM produces a curated timetable for the whole of the London region, that, unfortunately, can not be calculated (for more info, see: https://www.eastlondonmosque.org.uk/prayer-times-and-calendar-explained).

While arguably more correct (since they use your precise location as an input), the libraries relying on calculation will not match up with the ELM dataset. The ELM timetable is shared by The London Central Mosque, and so has the mindshare of many mosques across London. So if you want your application to likely match the timetable of your local London mosque, this this library may be for you.

Most of the existing PyPi libraries also choose to wrap https://aladhan.com/, which means they require an online connection to operate (which although convenient seems a bit convoluted for a calculation that could easily be performed locally). The aim of this library is to be able to operate offline as much as possible, by maintaining a local store of prayer times.

Why not just use https://www.londonprayertimes.com?

There are a few reasons:

  1. The LUPT website is not the gold source for this data. It is run by awesome volunteers who appear to manually upload transformed data from elsewhere (probably ELM’s website). As this library is intentionally designed to make a locally available copy, it’s probably a better idea for it to go directly to a source of that data.

  2. The primary role of the LUPT website appears to be to make time strings available to mosque UI apps. Something like Home Assistant requires data a little more “machine-friendly”, like times in UTC or epoch time. And again, if we’re to transform the LUPT website data anyway then it makes more sense to go to a source.

Why is this written in Python?

Although not my first choice of language, this library has primarily been written for use with Home Assistant, which itself is written in Python. Since this library doesn’t actually do that much, it made sense to keep it as native as possible.

Please excuse the anti-Python patterns - PRs are welcome. Although please, no comments on the lack of classes, that bit’s deliberate.

Will you pray for me?

Of course! But please be aware that I will not be responsible for you missing Fajr.

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

1.0.0 (2021-02-15)

  • First release on PyPI.

1.0.1 (2021-02-16)

  • Converted Markdown docs to RST.

1.1.0 (2021-04-25)

  • Now scrape from HTML page.

1.2.0 (2021-05-04)

  • Each day entry now has easier access to tomorrow’s day entry.

1.2.1 (2021-05-16)

  • Fixed default config for Mithl string replacement.

1.2.2 (2021-05-26)

  • Suppress printing error while initialising new timetable.

1.2.3 (2021-05-31)

  • Replace Mithl 2 by default.

1.2.4 (2021-05-31)

  • Support dicts as replace strings configs.

1.2.5 (2021-05-31)

  • Default config now reloads from json instead of recylcing cached.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

london_unified_prayer_times-1.2.5.tar.gz (26.9 kB view details)

Uploaded Source

Built Distribution

london_unified_prayer_times-1.2.5-py2.py3-none-any.whl (16.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file london_unified_prayer_times-1.2.5.tar.gz.

File metadata

  • Download URL: london_unified_prayer_times-1.2.5.tar.gz
  • Upload date:
  • Size: 26.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for london_unified_prayer_times-1.2.5.tar.gz
Algorithm Hash digest
SHA256 b85779b28be5265a1c6d50e6656c772bfe2c7b1418500af1fe53325611798206
MD5 4d02ce899599b83153d0e35fc9adc060
BLAKE2b-256 457fb4084b4c1da8e9e63e5b57d39b171c32aac9d5e282ffc369531153dee332

See more details on using hashes here.

File details

Details for the file london_unified_prayer_times-1.2.5-py2.py3-none-any.whl.

File metadata

  • Download URL: london_unified_prayer_times-1.2.5-py2.py3-none-any.whl
  • Upload date:
  • Size: 16.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for london_unified_prayer_times-1.2.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 cc9c265d8efd6adcaf39a04a4759bcd10733df2a5885ee6ab5f11e9d534b7275
MD5 b05566573c0f0d2608034dd0ce07bc79
BLAKE2b-256 275488ce6d939ab75965feb39e05c77f11e524355299ac4b9a4eac0a829271b0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page