DWD Pollen API Client

April 21, 2019 · View on GitHub

PyPI version

The DWD (Deutscher Wetterdienst) publishes information about the current and future pollen load in Germany. The data is published as an JSON endpoint and documented in this German PDF.

Install

pip install dwdpollen

region_id and partregion_id

The API uses the region_id and partregion_id to identify the different regions in Germany. The following regions are available:

Regionregion_idPartregionpartregion_id
Schleswig-Holstein und Hamburg10Inseln und Marschen11
Geest, Schleswig-Holstein und Hamburg12
Mecklenburg-Vorpommern20-1
Niedersachsen und Bremen30Westl. Niedersachsen/Bremen31
Östl. Niedersachsen32
Nordrhein-Westfalen40Rhein.-Westfäl. Tiefland41
Ostwestfalen42
Mittelgebirge NRW43
Brandenburg und Berlin50-1
Sachsen-Anhalt60Tiefland Sachsen-Anhalt61
Harz62
Thüringen70Tiefland Thüringen71
Mittelgebirge Thüringen72
Sachsen80Tiefland Sachsen81
Mittelgebirge Sachsen82
Hessen90Nordhessen und hess. Mittelgebirge91
Rhein-Main92
Rheinland-Pfalz und Saarland100Saarland103
Rhein, Pfalz, Nahe und Mosel101
Mittelgebirgsbereich Rheinland-Pfalz102
Baden-Württemberg110Oberrhein und unteres Neckartal111
Hohenlohe/mittlerer Neckar/Oberschwaben112
Mittelgebirge Baden-Württemberg113
Bayern120Allgäu/Oberbayern/Bay. Wald121
Donauniederungen122
Bayern n. der Donau, o. Bayr. Wald, o. Mainfranken123
Mainfranken124

Usage

The API will return the data on a best effort basis. There is no guarantee which dates exist in the result. Mostly the current and the next day are available and on Friday after 11 AM the data for Sunday should be available. But there is no guarantee, so the caller has to check the result itself. What? Yes... it sounds strange... but usually the DWD updates the API result everyday at 11 AM and on Friday the forecast for Sunday is included.

import dwdpollen
api = dwdpollen.DwdPollenApi()
api.get_pollen(50, -1)
{'region_id': 50,
 'region_name': 'Brandenburg und Berlin ',
 'partregion_id': -1,
 'partregion_name': '',
 'last_update': datetime.datetime(2019, 4, 18, 11, 0),
 'next_update': datetime.datetime(2019, 4, 19, 11, 0),
 'pollen': {'Graeser': {'2019-04-19': {'value': 0.0,
    'raw': '0',
    'human': 'keine Belastung'},
   '2019-04-20': {'value': 0.0, 'raw': '0', 'human': 'keine Belastung'}},
  'Roggen': {'2019-04-19': {'value': 0.0,
    'raw': '0',
    'human': 'keine Belastung'},
   '2019-04-20': {'value': 0.0, 'raw': '0', 'human': 'keine Belastung'}},
  'Hasel': {'2019-04-19': {'value': 0.0,
    'raw': '0',
    'human': 'keine Belastung'},
   '2019-04-20': {'value': 0.0, 'raw': '0', 'human': 'keine Belastung'}},
  'Beifuss': {'2019-04-19': {'value': 0.0,
    'raw': '0',
    'human': 'keine Belastung'},
   '2019-04-20': {'value': 0.0, 'raw': '0', 'human': 'keine Belastung'}},
  'Esche': {'2019-04-19': {'value': 2.0,
    'raw': '2',
    'human': 'mittlere Belastung'},
   '2019-04-20': {'value': 2.0, 'raw': '2', 'human': 'mittlere Belastung'}},
  'Birke': {'2019-04-19': {'value': 3.0,
    'raw': '3',
    'human': 'hohe Belastung'},
   '2019-04-20': {'value': 3.0, 'raw': '3', 'human': 'hohe Belastung'}},
  'Erle': {'2019-04-19': {'value': 0.0,
    'raw': '0',
    'human': 'keine Belastung'},
   '2019-04-20': {'value': 0.0, 'raw': '0', 'human': 'keine Belastung'}},
  'Ambrosia': {'2019-04-19': {'value': 0.0,
    'raw': '0',
    'human': 'keine Belastung'},
   '2019-04-20': {'value': 0.0, 'raw': '0', 'human': 'keine Belastung'}}}}

License

dwdpollen - API client for the "Deutscher Wetterdienst" to get the current pollen load in Germany Copyright (C) 2019 Max Rosin

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.