GitXplorerGitXplorer
l

katwarn-api

public
4 stars
1 forks
0 issues

Commits

List of commits on branch main.
Unverified
558841835d1730da5494c7c4b4570d7bb435bc1a

README: use archive.org URL for the official katwarn page

llazka committed 16 days ago
Unverified
2d6a551fdf15f0149ad35eb0442b7ece016be3c7

End the project

llazka committed 16 days ago
Unverified
970456daa9415f48d8a80bb451df5fad38be0761

Update CI deps

llazka committed 7 months ago
Unverified
5d004dbf943d32b4f60a0dd04ad8d2163465ebfa

new CA cert

llazka committed 7 months ago
Unverified
445e521dc530bf5db6d5fbff3e8f898360c7d818

Update deps

llazka committed 8 months ago
Unverified
1c05c7ef96f637c9f845e3a9b11cd88f668f3b5c

Update deps

llazka committed 9 months ago

README

The README file for this repository.

Python API Client for KATWARN

UPDATE 2025-01-02: Since KATWARN is no longer used in Austria since 2024-09-30, and the last Austrian alert expired at the end of 2024 this API is no longer useful for Austria and the archival process has been stopped as of 2025-01-02. The archive of all alerts in 2024 is still available in the git history.

NOTE: This is just a hobby project and not affiliated with KATWARN in any way.

On the national alert test day, when a test alert was displayed on the official KATWARN Austria app, I wondered if there was also a website where this data was displayed, and if there was any kind of history to see what types of alerts are usually reported via KATWARN and how often.

I couldn't find anything for Austria, but it turns out KATWARN provides a REST API. So here is a simple API client, and also a GitHub action which regularly dumps the API responses into git, so one can see a history of all alerts.

This is just a minimal implementation, feedback welcome.

# pip install git+https://github.com/lazka/katwarn-api

from katwarn_api import KatWarnApi

api = KatWarnApi()
for entry in api.get_incidents().incidents:
    incident = api.get_incident(entry.id)
    for alert_id in incident.alerts:
        alert = api.get_alert(incident.id, alert_id)
        print(f"{entry.provider_id}: [{alert.event_code.value}] {alert.headline}")

Examples

Print a map of all alerts (excluding topic alerts) via folium:

  • poetry install --with folium
  • poetry run folium_example.py -o map.html

folium_example.jpg

Dump all resources to a JSON file:

  • poetry run dump.py -o dump.json

List all service areas, topics, and alerts:

  • poetry run example.py