Skip to content

Instantly share code, notes, and snippets.

@sergiolucero
Last active April 21, 2018 04:51
Show Gist options
  • Save sergiolucero/1286d29dc739eec6123bd38499743a90 to your computer and use it in GitHub Desktop.
Save sergiolucero/1286d29dc739eec6123bd38499743a90 to your computer and use it in GitHub Desktop.
pybikes scraper
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)))
@sergiolucero
Copy link
Author

This only gets data from the VELIB system. There is much better here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment