Skip to main content

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.util.param import Param
from mawaqit_alexa.services.calendar_generator import MawaqitCalendarGenerator

# Configure parameters
Param.ALARM_BEFORE_MINUTES = 15  # Alarm 15 minutes before prayer
Param.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}_{Param.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
)

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 Param class allows you to configure:

  • 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

mawaqit_alexa-1.0.4.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mawaqit_alexa-1.0.4-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file mawaqit_alexa-1.0.4.tar.gz.

File metadata

  • Download URL: mawaqit_alexa-1.0.4.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mawaqit_alexa-1.0.4.tar.gz
Algorithm Hash digest
SHA256 5c39ffba53eb885ebc694e13a0b19e15d81effee91c781a74c2d2b2bc538db8b
MD5 96c0ce718f8cf3440665e60a03bf2522
BLAKE2b-256 a1f48e8ed377526e4f1e7dea87ed5fa4c5c7619e6dcbe7c4f24a1d3f20cd1665

See more details on using hashes here.

Provenance

The following attestation bundles were made for mawaqit_alexa-1.0.4.tar.gz:

Publisher: wheels.yml on Ahmad-Said/mawaqit_alexa

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mawaqit_alexa-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: mawaqit_alexa-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mawaqit_alexa-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7eb70d7de566f8f16226a2e28342f9c2a4d16bad14fb3e52ab07deae32011b95
MD5 197fd15916f5f49ea144eaffc44f5d08
BLAKE2b-256 84590220ac8e9af5764e738136eb3979a1d6208921fffb3cb4f743e766e2ea6f

See more details on using hashes here.

Provenance

The following attestation bundles were made for mawaqit_alexa-1.0.4-py3-none-any.whl:

Publisher: wheels.yml on Ahmad-Said/mawaqit_alexa

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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