Metadata-Version: 2.4
Name: dlpwait
Version: 1.1.0
Summary: Asynchronous Python client for Disneyland Paris park data
Project-URL: Homepage, https://github.com/glenndehaan/python-dlpwait
Project-URL: Issues, https://github.com/glenndehaan/python-dlpwait/issues
Author-email: Glenn de Haan <glenn@dehaan.cloud>
License: MIT
License-File: LICENCE
Requires-Python: >=3.11
Requires-Dist: aiohttp>=3.0.0
Description-Content-Type: text/markdown

# DLPWait API Client

An **asynchronous Python client** for fetching real-time **Disneyland Paris park and attraction data** via the DLPWait API.
This lightweight library provides methods for retrieving park hours, attractions, and standby wait times.

## Features

* Asynchronous communication using `aiohttp`
* Fetch park hours and operating schedules
* Fetch attractions
* Get real-time standby wait times
* Built-in error handling for connection and parsing failures
* Designed for easy integration into automation tools or async workflows

## Requirements

* Python **3.11+**
* `aiohttp` library

## Usage Example

```python
import asyncio
from dlpwait import DLPWaitAPI, DLPWaitConnectionError, Parks

async def main():
    client = DLPWaitAPI()

    try:
        await client.update()  # Fetch all park data

        for park in Parks:
            park_data = client.parks[Parks(park)]
            print(f"{park_data.slug} is open from {park_data.opening_time} to {park_data.closing_time}")
            print("Attractions:")
            for attraction_id, name in park_data.attractions.items():
                wait_time = park_data.standby_wait_times.get(attraction_id, "N/A")
                print(f"  {name}: {wait_time} min")

    except DLPWaitConnectionError as err:
        print(f"Error fetching park data: {err}")

    finally:
        await client.close()

asyncio.run(main())
```

## API Reference

### Class: `DLPWaitAPI`

#### Initialization

```python
DLPWaitAPI(session: aiohttp.ClientSession | None = None)
```

* **session** *(optional)* – existing `aiohttp.ClientSession` to reuse.

#### Fetch & Update Methods

| Method     | Description                              |
|------------|------------------------------------------|
| `update()` | Fetch and parse all park data            |
| `close()`  | Close the HTTP session to free resources |

### Models

#### `Parks` Enum

| Member                   | Description                 |
|--------------------------|-----------------------------|
| `DISNEYLAND`             | Disneyland Park             |
| `DISNEY_ADVENTURE_WORLD` | Disney Adventure World Park |

#### `Park` Dataclass

| Field                | Type                     | Description                                   |
|----------------------|--------------------------|-----------------------------------------------|
| `slug`               | `Parks`                  | Park identifier                               |
| `opening_time`       | `datetime`               | Park opening time                             |
| `closing_time`       | `datetime`               | Park closing time                             |
| `attractions`        | `dict[str, str]`         | Attraction IDs mapped to names                |
| `standby_wait_times` | `dict[str, int \| None]` | Attraction IDs mapped to wait times (minutes) |

## Exception Handling

All exceptions inherit from `DLPWaitError`.

| Exception                | Description                                         |
|--------------------------|-----------------------------------------------------|
| `DLPWaitError`           | Base exception for DLPWait client                   |
| `DLPWaitConnectionError` | Connection-related errors (timeouts, bad responses) |

## License

MIT
