Created
June 6, 2011 10:46
-
-
Save jasonmc/1010065 to your computer and use it in GitHub Desktop.
CLI script to get the Dublin Bus info for a stop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib | |
import json | |
def main(location = "westland+row/00495"): | |
data = json.loads(urllib.urlopen("http://dublinbus-api.heroku.com/stops/%s"%location).read())['data'][0] | |
if data['active']: | |
for bus in data['buses']: | |
print bus['route'],'\t',bus['destination'],'\t',bus['time'] | |
else: | |
print "No services running currently" | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment