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
- Comment
- CommentInner
- CurrentMeasurement
- MeasurementResult
- MeasurementResultInner
- Station
- StationOverviewResult
- StationWater
- Timeseries
- TimeseriesGaugeZero
- TimeseriesNotFound
- WaterResult
Documentation For Authorization
All endpoints do not require authorization.
Author
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for de_pegel_online-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a76a793664a923cca3300d0d41056ca2ca2ae2aa3b88bb73d00b2fabc212bbd4 |
|
MD5 | 7772d6c1267e3e315d63381643a1e418 |
|
BLAKE2b-256 | af289506ca8cdbaa117e7fd431797c6fb3b39f3b41225fc308af0853fe9d3982 |