autobahn

October 9, 2021 · View on GitHub

Was passiert auf Deutschlands Bundesstraßen? API für aktuelle Verwaltungsdaten zu Baustellen, Staus und Ladestationen. Außerdem Zugang zu Verkehrsüberwachungskameras und vielen weiteren Datensätzen.

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

  • API version: 1.0.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

Requirements.

Python >= 3.6

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/bundesAPI/deutschland.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/bundesAPI/deutschland.git)

Then import the package:

from deutschland import autobahn

Setuptools

Install via Setuptools.

python setup.py install --user

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

Then import the package:

from deutschland import autobahn

Getting Started

Please follow the installation procedure and then run the following:


import time
from deutschland import autobahn
from pprint import pprint
from deutschland.autobahn.api import default_api
from deutschland.autobahn.model.closure import Closure
from deutschland.autobahn.model.closures import Closures
from deutschland.autobahn.model.electric_charging_station import ElectricChargingStation
from deutschland.autobahn.model.electric_charging_stations import ElectricChargingStations
from deutschland.autobahn.model.parking_lorries import ParkingLorries
from deutschland.autobahn.model.parking_lorry import ParkingLorry
from deutschland.autobahn.model.road_id import RoadId
from deutschland.autobahn.model.roads import Roads
from deutschland.autobahn.model.roadwork import Roadwork
from deutschland.autobahn.model.roadworks import Roadworks
from deutschland.autobahn.model.warning import Warning
from deutschland.autobahn.model.warnings import Warnings
from deutschland.autobahn.model.webcam import Webcam
from deutschland.autobahn.model.webcams import Webcams
# Defining the host is optional and defaults to https://verkehr.autobahn.de/o/autobahn
# See configuration.py for a list of all supported configuration parameters.
configuration = autobahn.Configuration(
    host = "https://verkehr.autobahn.de/o/autobahn"
)



# Enter a context with an instance of the API client
with autobahn.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = default_api.DefaultApi(api_client)
    station_id = "RUxFQ1RSSUNfQ0hBUkdJTkdfU1RBVElPTl9fMTczMzM=" # str | 

    try:
        # Details zu einer Ladestation
        api_response = api_instance.get_charging_station(station_id)
        pprint(api_response)
    except autobahn.ApiException as e:
        print("Exception when calling DefaultApi->get_charging_station: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://verkehr.autobahn.de/o/autobahn

ClassMethodHTTP requestDescription
DefaultApiget_charging_stationGET /details/electric_charging_station/{stationId}Details zu einer Ladestation
DefaultApiget_closureGET /details/closure/{closureId}Details zu einer Sperrung
DefaultApiget_parking_lorryGET /details/parking_lorry/{lorryId}Details eines Rastplatzes
DefaultApiget_roadworkGET /details/roadworks/{roadworkId}Details einer Baustelle
DefaultApiget_warningGET /details/warning/{warningId}Details zu einer Verkehrsmeldung
DefaultApiget_webcamGET /details/webcam/{webcamId}Details einer Webcam
DefaultApilist_autobahnenGET /Liste verfügbarer Autobahnen
DefaultApilist_charging_stationsGET /{roadId}/services/electric_charging_stationListe aktueller Ladestationen
DefaultApilist_closuresGET /{roadId}/services/closureListe aktueller Sperrungen
DefaultApilist_parking_lorriesGET /{roadId}/services/parking_lorryListe verfügbarer Rastplätze
DefaultApilist_roadworksGET /{roadId}/services/roadworksListe aktueller Baustellen
DefaultApilist_warningsGET /{roadId}/services/warningListe aktueller Verkehrsmeldungen
DefaultApilist_webcamsGET /{roadId}/services/webcamListe verfügbarer Webcams

Documentation For Models

Documentation For Authorization

All endpoints do not require authorization.

Author

Notes for Large OpenAPI documents

If the OpenAPI document is large, imports in autobahn.apis and autobahn.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.autobahn.api.default_api import DefaultApi
  • from deutschland.autobahn.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 autobahn
from deutschland.autobahn.apis import *
from deutschland.autobahn.models import *