Welcome to VGN’s documentation!¶
Functions¶
-
vgn.functions.
additional_information
(stop_id: int) → List[str]¶ List of information text strings for a given stop.
Parameters: stop_id (int) – The VGN stop identifier number. Returns: List of strings containing additional information for the given station. Return type: list
-
vgn.functions.
api_version
() → str¶ Metadata version info from the VGN REST-API.
-
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 = 0) → List[vgn.data_classes.Departure]¶ Departures for a specific stop.
Parameters: - stop_id (int) – The VGN stop identifier number.
- transport_type – Information shall only be given for the defined transport means of transportation.
- limit_result – Limit amount of returned results. Zero means no limit.
- timedelay – Time delay for the request in minutes.
- timespan – 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 = 0) → 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 (int) – The VGN stop identifier number.
- limit_result – Limit amount of returned results. Zero means no limit.
- timedelay – Time delay for the request in minutes.
- timespan – Time window for the query in minutes.
Returns: List of departures for the given station and line.
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 – Radius for search in meter
Returns: List of station objects in radius of the given location.
Return type: list
-
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 – Time window in minutes (default 60 minutes)
Returns: List of rides for the given transport type within the time window.
Return type: list
-
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:
-
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:
-
vgn.functions.
stations
(stop_name: str = '') → List[vgn.data_classes.Station]¶ List with the stops for the specified stop name.
Parameters: stop_name – Name of the station (like). Returns: List of station objects with the stop_name, or all stations if stop_name is not defined. Return type: list
Data Classes¶
-
class
vgn.data_classes.
Coordinates
(latitude: float, longitude: float)¶ Coordinates in WGS 84 Format in degrees.
-
class
vgn.data_classes.
Departure
(line_name: str, station_id: str, direction: str, direction_text: str, planned_departure_time: datetime.datetime, actual_departure_time: datetime.datetime, transport_type: vgn.data_classes.TransportType, coordinates: vgn.data_classes.Coordinates, ride_id: int, ride_type_id: int, vehicle_number: str, forecast: bool)¶ Departure data object class.
-
class
vgn.data_classes.
Ride
(ride_id: int, line_name: str, direction: str, operating_day: datetime.date, start_time: datetime.datetime, end_time: datetime.datetime, start_station_id: str, end_station_id: str, vehicle_number: str)¶ Ride data object class.
-
class
vgn.data_classes.
Route
(line_name: str, direction: str, direction_text: str, ride_id: int, operating_day: datetime.date, is_cancelled: bool, additional_ride: bool, vehicle_number: str, transport_type: vgn.data_classes.TransportType, route: List[vgn.data_classes.RoutePoint])¶ Route for a specific ride.
-
class
vgn.data_classes.
RoutePoint
(station_name: str, station_id: int, stop_point: str, planned_arrival_time: datetime.datetime, actual_arrival_time: datetime.datetime, planned_departure_time: datetime.datetime, actual_departure_time: datetime.datetime, direction_text: str, coordinates: vgn.data_classes.Coordinates, transit: bool, no_boarding: bool, no_get_off: bool, additional_stop: bool)¶ Single stop of a route.
-
class
vgn.data_classes.
Station
(name: str, station_id: int, coordinates: vgn.data_classes.Coordinates, transport_types: List[vgn.data_classes.TransportType])¶ Station data object class.
-
class
vgn.data_classes.
TransportType
¶ Type of transportation (e.g.: bus, tram, subway).