mawaqit / home-assistant

Mawaqit integration - salat time and nearest mosque - in Home Assistant
60 stars 16 forks source link

how to get an api token #32

Closed aceisace closed 1 year ago

aceisace commented 1 year ago

Hi Mawaqit dev team, I'm trying to build a simple PWA-app (non-profit), just because it's a bit more convenient and doesn't require installation. While I do know that there is an option to simply select the mosque and display the timings via HTML, having the bare data (prayer timings) via an API would help reduce the load on your servers too. What's more is that having an 40" lcd monitor run 24/7 gets a bit costly with the electricity prices increasing. So my local mosque turns off the monitor when no-one's around and forget to turn it back on (or just to save electricity). If I get the time to, I'll make a low-power alternative which can run for months on a single battery.

As it turns out, I cannot access the prayer timings directly via the API without a token. So, as instructed, I created an account, but still do not know how to get a token. Without the token, https://mawaqit.net/api/2.0{base_url}/mosque/{mosque_id}/prayer-times returns a 403. The mosque id is also correct, as otherwise I get an 404.

While I have already written a scraper to fetch the data from HTML, it's too expensive in terms of CPU power on both ends. My question is, how can I get just the prayer timings of my mosque, ideally without an api key or sensitive data. If a login is indeed a requirement, how can I get the api-token to access the direct prayer timings?

aceisace commented 1 year ago

Never mind, I got it working. Closing this issue as it has been self-resolved.