InfraNode.dev
MCP InfraNode is also available as an MCP server for AI assistants like Claude and ChatGPT.

Fetch German city data with Python and pandas

Tutorial: fetch open data for German cities with Python, requests and pandas through the free, keyless InfraNode API and analyze it as a DataFrame across all cities.

Fetch one city

InfraNode serves open data for German cities through a free, keyless REST API. Getting started with requests is one line:

import requests

base = "https://infranode.dev/api/v1"
r = requests.get(f"{base}/cities/berlin/weather", timeout=10)
r.raise_for_status()
payload = r.json()["data"]["payload"]
print(payload["temperature_c"], payload["condition"])

The domain data sits in the envelope under data.payload, provenance and cache status under meta.

Cross-section across many cities

For an analysis across several cities, first fetch the city list and then iterate over the slugs to build a pandas DataFrame you can sort, filter or plot:

import requests
import pandas as pd

base = "https://infranode.dev/api/v1"
cities = requests.get(f"{base}/cities", timeout=10).json()["data"]

rows = []
for c in cities[:10]:
    slug = c["slug"]
    resp = requests.get(f"{base}/cities/{slug}/air-uba", timeout=10)
    if resp.status_code != 200:
        continue
    p = resp.json()["data"]["payload"]
    rows.append({"city": slug, "pm10": p.get("pm10"), "no2": p.get("no2")})

df = pd.DataFrame(rows)
print(df.sort_values("pm10", ascending=False))

Mind the rate limit of 300 requests per minute per IP. For all 84 cities, add a small time.sleep or a retry backoff on status 429.

What data is available

Per city you get, among others, weather, air quality, electricity price, land values and real-time public transport. The full field reference is in the API documentation.

Frequently asked questions

Do I need to register or request a key?
No. The API is keyless and free. A simple GET request with requests is enough, no headers or tokens.
Where is the domain data in the response?
Under data.payload. Metadata such as source, license and cache status is under meta and in the attribution block.
Is there a ready-made dataset for offline analysis?
Yes. Reproducible snapshots as CSV and Parquet are available via the Zenodo DOI and as a Hugging Face dataset.