summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bvggrabber/api/__init__.py5
-rw-r--r--bvggrabber/api/scheduleddeparture.py2
-rw-r--r--tests/test_api.py4
3 files changed, 6 insertions, 5 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())
diff --git a/tests/test_api.py b/tests/test_api.py
index c4cd445..6180ae2 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -185,7 +185,7 @@ class TestDeparture(BaseTestDeparture):
'when_full': "2013-01-02 03:04:45",
'when_hour': "03:04",
'remaining': 0}
- dep1 = Departure(b"From My Station", "To Your Station",
+ dep1 = Departure("From My Station", "To Your Station",
self.since + self.delta1, "A Line", since=self.since)
self.assertEqual(json1, json.loads(dep1.to_json))
str1 = "Start: From My Station, End: To Your Station, when: 03:04, " \
@@ -200,7 +200,7 @@ class TestDeparture(BaseTestDeparture):
'when_full': "2013-01-02 03:05:20",
'when_hour': "03:05",
'remaining': 60}
- dep2 = Departure(b"From My Station", "To Your Station",
+ dep2 = Departure("From My Station", "To Your Station",
self.since + self.delta2, "A Line", since=self.since)
self.assertEqual(json2, json.loads(dep2.to_json))
str2 = "Start: From My Station, End: To Your Station, when: 03:05, " \