import requests
import json
import sqlite3
import os
if os.path.exists("foodtrucks.db"):
  os.remove("foodtrucks.db")
db = sqlite3.connect("foodtrucks.db")
db.cursor().executescript("""
  CREATE TABLE trucks (
      ... SQL redacted ...
  );
""")
unfiltered_json = requests.get("https://www.bnefoodtrucks.com.au/api/1/trucks")
trucks_dictionary = json.loads(unfiltered_json.text)
for truck in trucks_dictionary:
  db.cursor().execute("INSERT INTO trucks VALUES (?,?,?,?,?,?)",
    (
      truck["name"],
      ... Python redacted ...
      truck["avatar"]["src"]
    )
  )
db.commit()
db.close()


ia2:2222

back to https://voidinit.com