Station

class vbbpy.station.Station(stationId: str, getName: bool = True)

Contains information about a station.

departures = []
getDepartures(span=10) → None

Requests the next departures from the station and stores them into calling object.

Parameters

span – Optional time limit for the departures to fetch.

Returns

None

getLines() → None

Requests the lines available at the Station.

Returns

None

getProducts() → None

Requests the products available at the Station.

Returns

None

getStationName() → None

Requests the stations name using it’s id.

Returns

None

lines = []
makeStationsRequest(stationId: str, mode: vbbpy.modes.Modes, limit: int = 3, fuzzy: bool = False, completion: bool = True) → requests.models.Response

Makes a request string and parameters in order to fetch information from station API endpoint. Makes the request via fetchRequest().

Parameters
  • stationId – The station id to get information for.

  • mode – The type of station request to make.

  • limit – (optional) limit the amount of stations returned by the API in a STATIONS_QUERY request.

  • fuzzy – (optional) set to indicate possible typos in stationId by the API in a STATIONS_QUERY request.

  • completion – (optional) set to indicate stationId to be not full name of a station in a STATIONS_QUERY request.

Returns

Returns the fetched request.

makeStopsRequest(stopId: str, mode: vbbpy.modes.Modes, span: int = 10) → requests.models.Response

Makes a request string and parameters in order to fetch information from stops API endpoint. Makes the request via fetchRequest().

Parameters
  • stopId – The stop id to get information for.

  • mode – The type of stop request to make.

  • span – if mode is STOPS_ID_DEPARTURES, span is used to limit the departures for the next span minutes

Returns

Returns the fetched request.

name = ''
parseLocation(responseLoc: dict) → None

Parses the stations location from an API response.

Parameters

responseLoc – a part of the API response

Returns

None

parseStationResponse(response: dict, mode: vbbpy.modes.Modes) → int

Parses a station request.

Parameters
  • response – API station response to parse

  • mode – type of information to parse

Returns

Number of available lines or -1 on error

parseStopsResponse(response: dict, mode: vbbpy.modes.Modes) → int

Parses a stop request.

Parameters
  • response – API stop response to parse

  • mode – type of information to parse

Returns

-1, if the response is empty, or on other error 0 on success

position = None
printFullInfo() → None

Prints information about available products and lines of the station.

Returns

None

products = []
static queryStations(query: str) → list

Queries stations by their station name.

Parameters

query – The station name to query.

Returns

Returns a list of station with similar / same name as query.

stationId = ''