Skip to main content

pegel-online

API für das bundesweite Messstellennetz der Wasserstraßen- und Schifffahrtsverwaltung des Bundes.

Die API stellt drei verschiedene Ressourcen zur Verfügung: Station, Measurement, Water.

Authentifizierung / Autorisierung / API Limitierung

Es ist keine Authentifizierung oder Autorisierung notwendig. Aktuell besteht keine API Limitierung.

Allgemeine Query-Parameter

Zusätzlich zu den angegebenen Parametern sind ebenfalls allgemeine Parameter für alle Schnittstellen verfügbar (Dokumentation).

  • charset: Gibt die Kodierung der Response an. Standard ist hier UTF-8. Möglich ist z.B. auch ISO-8859-1.
  • prettyprint: Kann die zur besseren Lesbarkeit standardmäßig aktivierte Teilung der Response in mehreren Zeilen deaktivieren: prettyprint=false. Diese Einstellung wird für den produktiven Einsatz empfohlen.
  • limit/offset: Einschränkung der Anzahl der Ergebnisse. Hiermit kann 'Pagination' realisiert werden. limit gibt dabei die Anzahl der zurückgegebenen Elemente an. offset ermöglicht einen Offset vom Startwert. Beispiel: limit=10&offset=20 bedeutet, dass 10 Elemente beginnend mit dem 21. Element zurückgegeben werden.

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 1.0.0
  • Package version: 0.1.1
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen For more information, please visit https://www.pegelonline.wsv.de/

Requirements.

Python >= 3.6

Installation & Usage

pip install

pip install deutschland[pegel_online]

poetry install

poetry add deutschland -E pegel_online

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Usage

Import the package:

from deutschland import pegel_online

Getting Started

Please follow the installation procedure and then run the following:

import time
from deutschland import pegel_online
from pprint import pprint
from deutschland.pegel_online.api import measurement_api
from deutschland.pegel_online.model.measurement_result import MeasurementResult
from deutschland.pegel_online.model.timeseries_not_found import TimeseriesNotFound
# Defining the host is optional and defaults to https://www.pegelonline.wsv.de/webservices/rest-api/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = pegel_online.Configuration(
    host = "https://www.pegelonline.wsv.de/webservices/rest-api/v2"
)



# Enter a context with an instance of the API client
with pegel_online.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = measurement_api.MeasurementApi(api_client)
    station = "593647aa-9fea-43ec-a7d6-6476a76ae868" # str | UUID / Name / Pegelnummer der Station.
    timeseries = "W" # str | timeseries shortname
    start = "2022-02-06T09:00:00+01:00" # str | Zeitpunkt codiert im [ISO_8601](https://de.wikipedia.org/wiki/ISO_8601) Format. Angabe eines Datums oder einer Period (_P_, z.B. 'P8D' für die Messwerte der letzten 8 Tage) sind möglich. (optional)
    end = "" # str | Endzeitpunkt codiert im [ISO_8601](https://de.wikipedia.org/wiki/ISO_8601) Format. Kann auch leer gelassen werden, dann wird automatisch der aktuelle Zeitstempel verwendet. (optional)

    try:
        # Zugriff auf die Ressource Measurement
        api_response = api_instance.get_measurement_by_station(station, timeseries, start=start, end=end)
        pprint(api_response)
    except pegel_online.ApiException as e:
        print("Exception when calling MeasurementApi->get_measurement_by_station: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://www.pegelonline.wsv.de/webservices/rest-api/v2

Class Method HTTP request Description
MeasurementApi get_measurement_by_station GET /stations/{station}/{timeseries}/measurements.json Zugriff auf die Ressource Measurement
MeasurementApi get_measurement_diagram_by_station GET /stations/{station}/{timeseries}/measurements.png Zugriff auf die Ressource Measurement - Rückgabe als Diagramm (PNG)
StationApi get_stations GET /stations.json Übersicht über alle Stationen (Pegel)
StationApi get_stations_by_id GET /stations/{station}.json Zugriff auf eine bestimmte Station (Pegel)
WaterApi get_current_measurment_by_station GET /stations/{station}/{timeseries}.json Zugriff auf eine Timeseries
WaterApi get_waters GET /waters.json Zugriff auf die Ressource Water

Documentation For Models

Documentation For Authorization

All endpoints do not require authorization.

Author

kontakt@bund.dev

Notes for Large OpenAPI documents

If the OpenAPI document is large, imports in pegel_online.apis and pegel_online.models may fail with a RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:

Solution 1: Use specific imports for apis and models like:

  • from deutschland.pegel_online.api.default_api import DefaultApi
  • from deutschland.pegel_online.model.pet import Pet

Solution 2: Before importing the package, adjust the maximum recursion limit as shown below:

import sys
sys.setrecursionlimit(1500)
from deutschland import pegel_online
from deutschland.pegel_online.apis import *
from deutschland.pegel_online.models import *

Metadata

Release files for de-pegel-online 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for de-pegel-online 0.1.1
File Size Uploaded
de_pegel_online-0.1.1.tar.gz 48.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for de-pegel-online 0.1.1
File Interpreter ABI Platform
de_pegel_online-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 143.3 kB

Release files / de_pegel_online-0.1.1.tar.gz

Download URL de_pegel_online-0.1.1.tar.gz
Size 48.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4ccde42f8287156563302fe13a0cbdb6bb99081880e2c30515d6e865157827d1
BLAKE2b-256 checksum
How to use checksums
c5f3e0cfec860e91acfb24d062e5099cf0a8262608f2ce51cde73663b4afb800
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Release files / de_pegel_online-0.1.1-py3-none-any.whl

Download URL de_pegel_online-0.1.1-py3-none-any.whl
Size 94.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a76a793664a923cca3300d0d41056ca2ca2ae2aa3b88bb73d00b2fabc212bbd4
BLAKE2b-256 checksum
How to use checksums
af289506ca8cdbaa117e7fd431797c6fb3b39f3b41225fc308af0853fe9d3982
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page