Metadata-Version: 2.4
Name: pyvasttrafik
Version: 0.1.0
Summary: Modern asynchronous Python client for Västtrafik Planera Resa API v4
Author: Ulf Tallmyr
License: MIT
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Python: >=3.12
Requires-Dist: aiohttp<4,>=3.10
Requires-Dist: python-dotenv>=1.0
Provides-Extra: dev
Requires-Dist: aioresponses>=0.7.7; extra == 'dev'
Requires-Dist: mypy>=1.13; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
Requires-Dist: pytest>=8.3; extra == 'dev'
Requires-Dist: ruff>=0.8; extra == 'dev'
Provides-Extra: test
Requires-Dist: aioresponses>=0.7.7; extra == 'test'
Requires-Dist: pytest-asyncio>=0.24; extra == 'test'
Requires-Dist: pytest>=8.3; extra == 'test'
Description-Content-Type: text/markdown

# python-vasttrafik

Modern asynchronous Python client for Västtrafik **Planera Resa API v4**.

This is the API library intended to power a modern Home Assistant integration. It does not contain Home Assistant-specific code.

## Current scope

- OAuth2 Client Credentials authentication
- Automatic token caching and refresh
- Search stop areas and other locations by text
- Fetch departures from a stop area
- Fetch departures from an exact stop point, such as platform A or B
- Typed immutable data models
- Async `aiohttp` implementation

## Installation for development

```bash
python -m venv .venv
.venv/Scripts/activate  # Windows PowerShell: .venv\Scripts\Activate.ps1
python -m pip install -e ".[dev]"
pytest
```

## Example

```python
import asyncio
from pyvasttrafik import VasttrafikClient


async def main() -> None:
    async with VasttrafikClient("CLIENT_ID", "CLIENT_SECRET") as client:
        locations = await client.search_locations("Sjöbo")
        for location in locations:
            print(location)


asyncio.run(main())
```

## API

The client targets:

- Token: `https://ext-api.vasttrafik.se/token`
- API base: `https://ext-api.vasttrafik.se/pr/v4`

A Västtrafik developer account, application, and subscription to **Planera Resa v4** are required.

## Status

Alpha. Response parsing is deliberately tolerant while real response fixtures are collected. The next milestone is to test against a real account and add explicit stop-area/stop-point discovery models.
