Metadata-Version: 2.4
Name: python-esolat
Version: 0.1.0
Summary: Asynchronous Python client for Malaysian prayer times (official JAKIM/e-Solat) and worldwide Aladhan calculation
Author: Zubir Jamal
License-Expression: MIT
Project-URL: Homepage, https://github.com/zubirjamal/python-esolat
Project-URL: Repository, https://github.com/zubirjamal/python-esolat
Project-URL: Issues, https://github.com/zubirjamal/python-esolat/issues
Keywords: esolat,waktusolat,jakim,prayer-times,solat,malaysia,aladhan,home-assistant
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Operating System :: OS Independent
Classifier: Topic :: Home Automation
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Intended Audience :: Developers
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: aiohttp>=3.9.0
Provides-Extra: test
Requires-Dist: pytest>=8.0.0; extra == "test"
Requires-Dist: pytest-asyncio>=0.23.0; extra == "test"
Dynamic: license-file

# python-esolat

[![PyPI version](https://img.shields.io/pypi/v/python-esolat.svg)](https://pypi.org/project/python-esolat/)
[![Python versions](https://img.shields.io/pypi/pyversions/python-esolat.svg)](https://pypi.org/project/python-esolat/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Asynchronous Python client for Malaysian prayer times (official JAKIM/e-Solat & WaktuSolat) and worldwide Aladhan calculation.

Designed as the core prayer times engine for [Home Assistant eSolat GPS](https://github.com/zubir2k/homeassistant-esolatgps), [eSolat Takwim](https://github.com/zubir2k/homeassistant-esolattakwim), and [esolat-mcp](https://github.com/zubir2k/esolat-mcp).

## Features

- **Automated Routing**:
  - **Malaysia (GPS or Zone)**: Fetches official JAKIM timetable via WaktuSolat API (with automatic fallback to JAKIM e-Solat Takwim API).
  - **Worldwide (outside Malaysia)**: Automatically queries the Aladhan API with configurable calculation methods.
- **Derived Islamic Times**:
  - Auto-calculates **Isyraq** (+12m) and **Dhuha** (+28m) after Syuruk/Sunrise.
- **Hijri Calendar Integration**:
  - Full Hijri date parsing with friendly month names (e.g. `21 Jamadil Awwal 1448`).
- **Major Islamic Events**:
  - Annual Islamic calendar events and public milestones (JAKIM for Malaysia, Aladhan globally).
- **Modern Python**:
  - Async-first (`aiohttp`), strongly typed dataclasses (`PrayerTimesResult`, `PrayerTimesDay`, `IslamicEvent`).

## Installation

```bash
pip install python-esolat
```

## Quick Start

```python
import asyncio
from esolat import EsolatClient

async def main():
    async with EsolatClient() as client:
        # 1. Fetch by GPS coordinates (Malaysia -> JAKIM / WaktuSolat)
        res = await client.get_prayer_times(latitude=3.0118, longitude=101.7949)
        print(f"Provider: {res.provider}, Zone: {res.zone}")
        for day in res.prayers[:3]:
            print(f"{day.date} ({day.hijri_full}): Subuh {day.fajr}, Dhuha {day.dhuha}, Zohor {day.dhuhr}")

        # 2. Fetch by JAKIM Zone code
        zone_res = await client.get_prayer_times(zone="SGR01")
        print(f"SGR01 Day 1 Subuh: {zone_res.prayers[0].fajr}")

        # 3. Fetch international coordinates (e.g. Makkah -> Aladhan)
        makkah_res = await client.get_prayer_times(latitude=21.4225, longitude=39.8262)
        print(f"Makkah provider: {makkah_res.provider}")

        # 4. Significant Islamic milestones
        events = await client.get_islamic_events(year=2026)
        for ev in events[:3]:
            print(f"{ev.gregorian_date}: {ev.event_name} ({ev.hijri_date})")

if __name__ == "__main__":
    asyncio.run(main())
```

## License

MIT © [Zubir Jamal](https://github.com/zubirjamal)
