-
-
Save richarddunks/f19804d396206d4d87234a2364dd8a44 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
''' | |
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