Skip to content

Instantly share code, notes, and snippets.

@jasonmc
Created June 6, 2011 10:46
Show Gist options
  • Save jasonmc/1010065 to your computer and use it in GitHub Desktop.
Save jasonmc/1010065 to your computer and use it in GitHub Desktop.
CLI script to get the Dublin Bus info for a stop
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