Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions chicagotransit/cta.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def time(self):
url = _base_url + 'gettime'
result = requests.get(url, params={'key': self.key})
xml = xmltodict.parse(result.text)
if 'tm' in xml['bustime-response'].keys():
if 'tm' in list(xml['bustime-response'].keys()):
time_str = xml['bustime-response']['tm']
return _time_translation(time_str)
else:
Expand All @@ -42,7 +42,7 @@ def bus_by_id(self, vid):
url = _base_url + 'getvehicles'
result = requests.get(url, params={'key': self.key, 'vid': vid})
xml = xmltodict.parse(result.text)
if 'vehicle' in xml['bustime-response'].keys():
if 'vehicle' in list(xml['bustime-response'].keys()):
v_data = xml['bustime-response']['vehicle']
time = v_data['tmstmp']
latitude = v_data['lat']
Expand Down Expand Up @@ -71,7 +71,7 @@ def routes(self, update=False):
url = _base_url + 'getroutes'
result = requests.get(url, params={'key': self.key})
xml = xmltodict.parse(result.text)
if 'error' in xml['bustime-response'].keys():
if 'error' in list(xml['bustime-response'].keys()):
errors.error_handler(xml['bustime-response']['error']['msg'])
self.bus_routes = []
for resp in xml['bustime-response']['route']:
Expand Down Expand Up @@ -116,7 +116,7 @@ def busses(self, update=False):
params = {'key': self.bt.key, 'rt': self.number}
result = requests.get(url, params=params)
xml = xmltodict.parse(result.text)
if 'vehicle' in xml['bustime-response'].keys():
if 'vehicle' in list(xml['bustime-response'].keys()):
for resp in xml['bustime-response']:
vid = resp['vid']
time = resp['tmstmp']
Expand Down Expand Up @@ -156,7 +156,7 @@ def stops(self, direction, update=False):
xml = xmltodict.parse(result.text)
if hasattr(self, 'stop') and not update:
return self.stops
elif 'stop' in xml['bustime-response'].keys():
elif 'stop' in list(xml['bustime-response'].keys()):
self.stop = []
for resp in xml['bustime-response']['stop']:
id = resp['stpid']
Expand Down
4 changes: 2 additions & 2 deletions chicagotransit/metra.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def stations(line):
req = requests.get(url, params=data)
j = json.loads(req.text)
stations = []
for s_order in j['stations'].keys():
for s_order in list(j['stations'].keys()):
name = j['stations'][s_order]['name']
id = j['stations'][s_order]['id']
stations.append(Station(id, name))
Expand All @@ -36,7 +36,7 @@ def trains(line, origin, destination):
req = requests.get(url, params=data)
j = json.loads(req.text)
trains = []
for key in j.keys():
for key in list(j.keys()):
if key[0:5].lower() == 'train':
t_dict = j[key]
train_num = t_dict['train_num']
Expand Down