Skip to main content
100%

Script for updating a database of the Citibike JSON feed

✓ Published0🌍 Public
JJoshAddington
Last edited Apr 8, 2015
Created on Mar 28, 2015

This example demonstrates a script that keeps a Citibike station and bike database current by parsing the live Citibike JSON feed. It shows how to update PostgreSQL records through Django models, capturing the feed’s execution time as separate date and time fields. The code uses the `requests` library to fetch the JSON, `datetime` to reformat timestamps, and Django’s `get_or_create` to add or retrieve station and bike entries. It also handles station ID changes by matching on station names, ensuring consistent data linkage across updates.

AI-generated description

Similar vizzes