Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save richarddunks/f19804d396206d4d87234a2364dd8a44 to your computer and use it in GitHub Desktop.
Save richarddunks/f19804d396206d4d87234a2364dd8a44 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