Skip to content

Instantly share code, notes, and snippets.

@kencrocken
Last active August 29, 2015 14:10
Show Gist options
  • Save kencrocken/cca6757c7be0d3165626 to your computer and use it in GitHub Desktop.
Save kencrocken/cca6757c7be0d3165626 to your computer and use it in GitHub Desktop.
import requests
response = requests.get('http://api.wmata.com/StationPrediction.svc/json/GetPrediction/B06,E06?api_key=kfgpmgvfgacx98de9q3xazww')
assert response.status_code == 200
data = response.json()
for prediction in data['Trains']:
print 'Line:{} | Destination: {} | Time: {} Minutes'.format(prediction['Line'], prediction['DestinationName'], prediction['Min'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment