Metadata-Version: 2.4
Name: ilidl
Version: 0.1.0
Summary: Unofficial Lidl Plus API client
Project-URL: Homepage, https://github.com/RoryDotGG/iLidl
Project-URL: Repository, https://github.com/RoryDotGG/iLidl
Project-URL: Issues, https://github.com/RoryDotGG/iLidl/issues
Author: RoryDotGG
License-Expression: MIT
License-File: LICENSE
Keywords: api-client,coupons,lidl,lidl-plus,receipts
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet
Classifier: Typing :: Typed
Requires-Python: >=3.12
Requires-Dist: click
Requires-Dist: httpx
Requires-Dist: tomli-w
Provides-Extra: auth
Requires-Dist: playwright; extra == 'auth'
Provides-Extra: dev
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Description-Content-Type: text/markdown

# iLidl

Unofficial Python client and CLI for the Lidl Plus API. Fetch receipts, parse item details, and manage coupons.

## Installation

```bash
pip install ilidl

# Or with uv
uv add ilidl

# With auth support (requires Playwright for login)
pip install "ilidl[auth]"
playwright install chromium
```

## Authentication

```bash
ilidl login
```

Launches a headless browser to complete the Lidl Plus OAuth flow. You'll be prompted for your phone number and a verification code. A refresh token is saved to `~/.config/ilidl/config.toml` for future use.

## CLI Usage

```bash
# Receipts
ilidl receipt latest              # Most recent receipt
ilidl receipt latest --json       # As JSON
ilidl receipt <id>                # Specific receipt
ilidl receipts                    # List all receipts
ilidl receipts --from 2026-03-01  # Filter by date
ilidl receipts --to 2026-03-18

# Coupons
ilidl coupons list                # List available coupons
ilidl coupons activate <id>       # Activate a coupon
ilidl coupons activate --all      # Activate all coupons
ilidl coupons deactivate <id>     # Deactivate a coupon
```

All commands support `--json` for machine-readable output.

## Library Usage

```python
from ilidl import LidlClient

client = LidlClient(refresh_token="...", country="GB", language="en")

# Get latest receipt with parsed items
receipt = client.latest_receipt()
for item in receipt.items:
    print(f"{item.name}: {item.price}")

# List coupons
for coupon in client.coupons():
    print(f"{coupon.title} (active: {coupon.is_activated})")
```

## Configuration

Stored at `~/.config/ilidl/config.toml`:

```toml
[auth]
refresh_token = "..."

[account]
language = "en"
country = "GB"
```

## Notes

- UK receipts are returned as HTML by the API and parsed into structured items using `data-*` attributes.
- The `App-Version` header must be a realistic value (currently `16.45.5`). The API rejects fake versions.
- API v2 is used for receipt lists, v3 for receipt detail.
- This project replaces the upstream `lidl-plus` library which is broken on modern Python.
