A simple mawaqit scraper for creating Calendar events and Alexa integration.
Project description
Mawaqit Alexa
A Python library to scrape prayer times from Mawaqit and generate iCalendar (.ics) files for integration with calendar apps and Alexa.
Features
- Scrape prayer times from any mosque on Mawaqit
- Generate iCalendar (.ics) files with prayer time events
- Support for both Arabic and English prayer names
- Configurable alarm notifications before prayer times
- CSV data provider for offline/exported data
- TTL-based caching to avoid excessive requests
Installing
To install the library, you can run the following command:
pip install mawaqit_alexa
Usage
Basic Example
import datetime
import os
from typing import Literal
from mawaqit_alexa.data_provider.scraping_mawaqit_provider import ScrapingMawaqitProvider
from mawaqit_alexa.services.calendar_generator import MawaqitCalendarGenerator
# Configure parameters
alarm_before_minutes = 15 # Alarm 15 minutes before prayer
summary_prefix = '' # Optional prefix for event summary
# Set the mawaqit mosque URL
data_url = 'https://mawaqit.net/fr/grande-mosquee-de-paris'
# Fetch prayer times
api_mawaqit_provider = ScrapingMawaqitProvider(data_url)
year_calendar = api_mawaqit_provider.get_current_year_calendar()
mosque_name = api_mawaqit_provider.masjid_endpoint
current_year = datetime.datetime.now().year
# Choose language: 'ar' for Arabic, 'en' for English
language: Literal['ar', 'en'] = 'ar'
# Set output file path
output_file = f'./data/out/{mosque_name}_{language}_{alarm_before_minutes}_{current_year}.ics'
output_file = os.path.join(os.getcwd(), output_file)
# Create the calendar
MawaqitCalendarGenerator.create_mawaqit_calendar(
year_calendar=year_calendar,
year=current_year,
output_file=output_file,
time_zone='Europe/Paris',
language=language,
alarm_before_minutes=alarm_before_minutes,
summary_prefix=summary_prefix
)
Using CSV Data Provider
If you have exported prayer times data from Mawaqit, you can use the CSV provider:
from mawaqit_alexa.data_provider.csv_mawaqit_provider import CsvMawaqitProvider
data_folder = './data/Nantes'
csv_provider = CsvMawaqitProvider(data_folder)
year_calendar = csv_provider.get_current_year_calendar()
Configuration
The create_mawaqit_calendar function accepts the following parameters:
year_calendar: The prayer times calendar datayear: The calendar yearoutput_file: Path to save the generated .ics filetime_zone: Timezone for the calendar events (default: 'Europe/Paris')language: Language for prayer names - 'en', 'ar', or 'fr' (default: 'en')alarm_before_minutes: Minutes before prayer time to trigger an alarm (default: 15)summary_prefix: Prefix to add to calendar event summaries (default: '')
License
MIT License - see LICENSE file for details.
Author
Ahmad SAID - GitHub
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mawaqit_alexa-1.0.5.tar.gz.
File metadata
- Download URL: mawaqit_alexa-1.0.5.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1bc956ef1f14c552c7e273d52fa7ea09721e21f5eba101c94cd0b8441209e17f
|
|
| MD5 |
b2cdc6d04d6d6d8b5da1abf4d475f26d
|
|
| BLAKE2b-256 |
c7288aec4582ab2bcbad4dedeac564f94d7b375214a30beeea368e2ab125f01f
|
Provenance
The following attestation bundles were made for mawaqit_alexa-1.0.5.tar.gz:
Publisher:
wheels.yml on Ahmad-Said/mawaqit_alexa
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mawaqit_alexa-1.0.5.tar.gz -
Subject digest:
1bc956ef1f14c552c7e273d52fa7ea09721e21f5eba101c94cd0b8441209e17f - Sigstore transparency entry: 794930036
- Sigstore integration time:
-
Permalink:
Ahmad-Said/mawaqit_alexa@f0c93c65e9e9a7dbe4f3a7d41df0a8070d52cdc1 -
Branch / Tag:
refs/tags/v1.0.5 - Owner: https://github.com/Ahmad-Said
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@f0c93c65e9e9a7dbe4f3a7d41df0a8070d52cdc1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mawaqit_alexa-1.0.5-py3-none-any.whl.
File metadata
- Download URL: mawaqit_alexa-1.0.5-py3-none-any.whl
- Upload date:
- Size: 13.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb8fd26b472f80b2e155239e403f4b983ddcae755f0c8731280bd13586177d1c
|
|
| MD5 |
9463f8abac1cff5e90b84a909256d883
|
|
| BLAKE2b-256 |
ddd872e3559188b676bd3e736d083013e9372089a3251661852c0b180a3f1fc9
|
Provenance
The following attestation bundles were made for mawaqit_alexa-1.0.5-py3-none-any.whl:
Publisher:
wheels.yml on Ahmad-Said/mawaqit_alexa
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mawaqit_alexa-1.0.5-py3-none-any.whl -
Subject digest:
cb8fd26b472f80b2e155239e403f4b983ddcae755f0c8731280bd13586177d1c - Sigstore transparency entry: 794930081
- Sigstore integration time:
-
Permalink:
Ahmad-Said/mawaqit_alexa@f0c93c65e9e9a7dbe4f3a7d41df0a8070d52cdc1 -
Branch / Tag:
refs/tags/v1.0.5 - Owner: https://github.com/Ahmad-Said
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@f0c93c65e9e9a7dbe4f3a7d41df0a8070d52cdc1 -
Trigger Event:
push
-
Statement type: