Last active
April 21, 2018 04:51
-
-
Save sergiolucero/1286d29dc739eec6123bd38499743a90 to your computer and use it in GitHub Desktop.
pybikes scraper
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
| import requests, sqlite3, pandas as pd | |
| url='https://api.citybik.es/v2/networks/velib' | |
| r=requests.get(url) | |
| conn = sqlite3.connect('pybikes.db') | |
| df = pd.DataFrame(r.json()['network']['stations']) | |
| df = df[['id','name','free_bikes','empty_slots','timestamp']] | |
| df.to_sql('velib', conn,if_exists='append') | |
| print('got %d points' %len(pd.read_sql('SELECT * FROM velib', conn))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This only gets data from the VELIB system. There is much better here.