4 ms·
Where does the data come from? The "System Data" on the website doesn't have anything yet
by JeffJenkins 13y ago
Where does the data come from? The "System Data" on the website doesn't have anything yet
- apples2apples 13y agoIn function currently_available_bikes, you see him curling: https://citibikenyc.com/stations/json https://citibikenyc.com/stations/json
- paddy_m 13y agoimport json def bikes_available_for_set(stats): available_count = 0 for s in stats['stationBeanList']: available_count += s['availableBikes'] return available_count def currently_available_bikes(): !curl https://citibikenyc.com/stations/json https://citibikenyc.com/stations/json > latest.json stats = json.loads(open("latest.json").read()) available_count = bikes_available_for_set(stats) print "there are currently %r bikes in stations" % available_count currently_available_bikes() That's the code block that I use to figure out how many bikes are currently available. I pull from stations/json url.
- JeffJenkins 13y agoThanks! This is awesome.