diff options
author | Markus Holtermann <info@markusholtermann.eu> | 2013-01-26 02:11:37 +0100 |
---|---|---|
committer | Markus Holtermann <info@markusholtermann.eu> | 2013-01-26 02:11:37 +0100 |
commit | e4f38481a629266d4f2b8231b92386d566f1568f (patch) | |
tree | 2f560e50f43491ef078522076086c3ad90c41888 /bvggrabber/api | |
parent | 8b5266b2999e4a18372c41c718044a44e089c525 (diff) | |
download | bvg-grabber-e4f38481a629266d4f2b8231b92386d566f1568f.tar.gz bvg-grabber-e4f38481a629266d4f2b8231b92386d566f1568f.tar.bz2 bvg-grabber-e4f38481a629266d4f2b8231b92386d566f1568f.zip |
the ``bvggrabber.api.Departure`` does not need to have a byte representation of the start
Diffstat (limited to 'bvggrabber/api')
-rw-r--r-- | bvggrabber/api/__init__.py | 5 | ||||
-rw-r--r-- | bvggrabber/api/scheduleddeparture.py | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/bvggrabber/api/__init__.py b/bvggrabber/api/__init__.py index c6ad86a..ed5ca3f 100644 --- a/bvggrabber/api/__init__.py +++ b/bvggrabber/api/__init__.py @@ -37,6 +37,7 @@ class Departure(object): self.now = datetime.datetime.now() else: self.now = since + self.start = start self.end = end self.line = line @@ -55,7 +56,7 @@ class Departure(object): def __str__(self): return "Start: %s, End: %s, when: %s, now: %s, line: %s" % ( - self.start.decode('iso-8859-1'), self.end, hourformat(self.when), + self.start, self.end, hourformat(self.when), hourformat(self.now), self.line) @property @@ -64,7 +65,7 @@ class Departure(object): @property def to_json(self): - return json.dumps({'start': self.start.decode('iso-8859-1'), + return json.dumps({'start': self.start, 'end': self.end, 'line': self.line, 'now_full': fullformat(self.now), diff --git a/bvggrabber/api/scheduleddeparture.py b/bvggrabber/api/scheduleddeparture.py index 38d8f8a..ba8664f 100644 --- a/bvggrabber/api/scheduleddeparture.py +++ b/bvggrabber/api/scheduleddeparture.py @@ -63,7 +63,7 @@ class ScheduledDepartureQueryApi(QueryApi): departures = [] for row in rows: tds = row.find_all('td') - dep = Departure(start=self.station_enc, + dep = Departure(start=self.station, end=tds[2].text.strip(), when=tds[0].text.strip(), line=tds[1].text.strip()) |