Extract, Transform, and Load script for fetching new data from the NYC Open Data Portal's vehicle collision data and loading into the NYC Crash Mapper table on CARTO.
CARTO_API_KEY environment variable is now explicitly checked and will exit with a message if not set; rather than attempting other operations and failing with an exception
SODA_API_COLLISIONS_BASEURL is now properly used as the URL in get_soda_data()
get_soda_data() now adds verify=False so as to skip HTTPS certificate hostname validation; on some Python installations, the requests library complains and fails by not properly handling the data.cityofnewyork.us hostname vs the certificate's stated Socrata hostnames
A few trivial fixes to the script:
CARTO_API_KEY
environment variable is now explicitly checked and will exit with a message if not set; rather than attempting other operations and failing with an exceptionSODA_API_COLLISIONS_BASEURL
is now properly used as the URL inget_soda_data()
get_soda_data()
now addsverify=False
so as to skip HTTPS certificate hostname validation; on some Python installations, the requests library complains and fails by not properly handling the data.cityofnewyork.us hostname vs the certificate's stated Socrata hostnames