Skip to main content

Pegel-Online API

Project description

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 *

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

de_pegel_online-0.1.1.tar.gz (48.9 kB view hashes)

Uploaded Source

Built Distribution

de_pegel_online-0.1.1-py3-none-any.whl (94.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page