Skip to content

Instantly share code, notes, and snippets.

@datapolitan
Created August 16, 2015 00:14
Show Gist options
  • Save datapolitan/81213689283ab5d5863d to your computer and use it in GitHub Desktop.
Save datapolitan/81213689283ab5d5863d to your computer and use it in GitHub Desktop.
'''
get the dock status and compute summary statistics for tweeting
'''
#need to wrap in try-catch
r = requests.get('http://www.citibikenyc.com/stations/json')
totalDocks_sum = 0
avail_bikes_sum = 0
in_service_station_sum = 0
for station in r.json()['stationBeanList']:
if station['statusKey'] == 1:
totalDocks_sum += station['totalDocks']
avail_bikes_sum += station['availableBikes']
in_service_station_sum += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment