Functions

API Version

vgn.functions.api_version() → str

Version info from the VGN REST-API.

Stations

vgn.functions.stations(station_name: str) → List[vgn.data_classes.Station]

List of stations for the specified station name.

Parameters:station_name – Name of a station.
Returns:List of station objects for the given stop_name.
Return type:list
vgn.functions.all_stations() → List[vgn.data_classes.Station]

List of all stations.

Returns:List of stations for the VGN transport association.
Return type:list
vgn.functions.nearby_stations(location: vgn.data_classes.Coordinates, radius: int = 1000) → List[vgn.data_classes.Station]

List stops close to a given location.

Parameters:
  • location – Search for stations close to this location.
  • radius (optional) – Radius for search in meter
Returns:

List of station objects in radius of the given location.

Return type:

list

vgn.functions.station_additional_information(stop_id: int) → List[str]

List of information text strings for a given stop.

Parameters:stop_id (optional) – The VGN stop identifier number.
Returns:List of strings containing additional information for the given station.
Return type:list

Departures

vgn.functions.departure_schedule(stop_id: int, transport_type: List[vgn.data_classes.TransportType] = [TransportType(), TransportType(), TransportType()], timespan: int = 10, timedelay: int = 5, limit_result: int = 100) → List[vgn.data_classes.Departure]

Departures for a specific stop.

Parameters:
  • stop_id – The VGN stop identifier number.
  • transport_type – Information shall only be given for the defined transport means of transportation.
  • limit_result (optional) – Limit amount of returned results. Default limit is 100.
  • timedelay (optional) – Time delay for the request in minutes.
  • timespan (optional) – Time window for the query in minutes.
Returns:

List of departures for the given station.

Return type:

list

vgn.functions.departure_schedule_for_line(stop_id: int, line_name: str, timespan: int = 10, timedelay: int = 5, limit_result: int = 100) → List[vgn.data_classes.Departure]

List of Departures for a specific stop and line.

Parameters:
  • line_name – Name of the line. For example ‘U2’ for the underground line two.
  • stop_id – The VGN stop identifier number.
  • limit_result (optional) – Limit amount of returned results. Default limit is 100.
  • timedelay (optional) – Time delay for the request in minutes.
  • timespan (optional) – Time window for the query in minutes.
Returns:

List of departures for the given station and line.

Return type:

list

Rides

vgn.functions.rides(transport_type: vgn.data_classes.TransportType, time_span: int = 60) → List[vgn.data_classes.Ride]

All running and starting rides for a given transport type within a given time frame (default 60 minutes)

Parameters:
  • transport_type – Transportation type. For example Bus.
  • time_span (optional) – Time window in minutes (default 60 minutes)
Returns:

List of rides for the given transport type within the time window.

Return type:

list

Routes

vgn.functions.route(transport_type: vgn.data_classes.TransportType, ride_id: int) → vgn.data_classes.Route

Route for a given transport type and ride number for the current operating day

Parameters:
  • transport_type – Transportation type. For example Bus.
  • ride_id – Ride number for the given transportation type
Returns:

The route for the given ride_number

Return type:

Route

vgn.functions.route_for_day(transport_type: vgn.data_classes.TransportType, ride_id: int, day: datetime.date) → vgn.data_classes.Route

Route for a given transport type, ride number and operating day.

Parameters:
  • transport_type – Transportation type. For example Bus.
  • ride_id – Ride number for the given transportation type.
  • day – Operating day date for the request.
Returns:

The route for the given ride_number on the requested day.

Return type:

Route