You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like something has changed on the bus tracker website and the example code gets an http return code 404. It seems like the URL should be updated to make the exercise work.
The text was updated successfully, but these errors were encountered:
I've added a note to the exercise about the API being deprecated. Sadly, I don't think I can modify the exercise to make it work as the bus-tracker now requires its users to sign up for an API key.
I was able to modify the code for the CTA Bus Tracker and get it to work.
It does require the use of an API key, however it's quite easy to get an API key and then start using the API.
Here's the modified code:
import urllib.request
u = urllib.request.urlopen('http://www.ctabustracker.com/bustime/api/v2/getpredictions?key=ADD_YOUR_API_KEY_HERE&rt=22&stpid=14791')
from xml.etree.ElementTree import parse
doc = parse(u)
print("Arrival time in minutes:")
for pt in doc.findall('.//prdctdn'):
print(pt.text)
Thanks a lot for making this course!!!
It looks like something has changed on the bus tracker website and the example code gets an http return code 404. It seems like the URL should be updated to make the exercise work.
The text was updated successfully, but these errors were encountered: