Metadata-Version: 2.4
Name: polisen_api
Version: 0.0.2
Summary: A python API wrapper for polisen.se
Author-email: dunderrrrrr <emil.bjorkroth@gmail.com>
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx>=0.28.1
Requires-Dist: pre-commit>=4.5.1
Requires-Dist: pytest>=9.0.2
Requires-Dist: respx>=0.22.0
Requires-Dist: mypy>=1.19.1
Requires-Dist: pydantic>=2.12.5
Requires-Dist: ruff>=0.14.14
Dynamic: license-file

<p align="center">
  <img src="https://i.imgur.com/mmqHYVx.png" />
</p>

# PolisenAPI


[![PyPI version](https://img.shields.io/pypi/v/polisen-api?style=for-the-badge)](https://pypi.org/project/polisen-api/) [![License](https://img.shields.io/badge/license-WTFPL-green?style=for-the-badge)](https://github.com/dunderrrrrr/polisen-api/blob/main/LICENSE) ![Python](https://img.shields.io/badge/Python-3.10-blue?style=for-the-badge)


PolisenAPI is a Python wrapper for [polisen.se](https://polisen.se/om-polisen/om-webbplatsen/oppna-data/api-over-polisens-handelser/), which allows you to search and filter for events published by the Swedish police.

## Install

PolisenAPI is available on [PyPI](https://pypi.org/project/polisen-api/).

```bash
uv add polisen-api
pip install polisen-api
```

## Usage

```python
from polisen_api import PolisenAPI
from datetime import date

api = PolisenAPI()

# Get all events (500 latest)
api.get_events()

# Filter by date, locations and types.
api.get_events(
  date=date(2026, 1, 10), 
  locations=["Stockholm", "Norrköping"]
  types=["Trafikolycka", "Inbrott"] # types can be found by browing the api response
)
```
