From 52c014264138af5d4f8a7b34fdf431abe689943d Mon Sep 17 00:00:00 2001 From: Markus Holtermann Date: Fri, 10 Oct 2014 01:01:18 +0200 Subject: Fixed #8 -- Added support for limit to ActualDepartureQueryApi --- bvggrabber/api/actualdeparture.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'bvggrabber') diff --git a/bvggrabber/api/actualdeparture.py b/bvggrabber/api/actualdeparture.py index 54eb6a7..a1b3b5a 100644 --- a/bvggrabber/api/actualdeparture.py +++ b/bvggrabber/api/actualdeparture.py @@ -11,7 +11,7 @@ ACTUAL_API_ENDPOINT = 'http://mobil.bvg.de/Fahrinfo/bin/stboard.bin/dox?ld=0.1&r class ActualDepartureQueryApi(QueryApi): - def __init__(self, station): + def __init__(self, station, limit=5): super(ActualDepartureQueryApi, self).__init__() if isinstance(station, str): self.station_enc = station.encode('iso-8859-1') @@ -20,9 +20,14 @@ class ActualDepartureQueryApi(QueryApi): else: raise ValueError("Invalid type for station") self.station = station + self.limit = limit def call(self): - params = {'input': self.station_enc, 'start': 'suchen'} + params = { + 'input': self.station_enc, + 'maxJourneys': self.limit, + 'start': 'suchen', + } response = requests.get(ACTUAL_API_ENDPOINT, params=params) if response.ok: soup = BeautifulSoup(response.text) -- cgit v1.2.3