Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Python3 / Sqlite3 / json / Question Hello, I\'m trying to inser data from an API

ID: 3755351 • Letter: P

Question

Python3 / Sqlite3 / json / Question

Hello, I'm trying to inser data from an API weather site to a database in SQLIte3 . I'm getting this error:     

cur.executemany('INSERT INTO wdata values (?,?,?,?)',forecasts)
ValueError: parameters are of unsupported type

here is an example how the data looks from the API :

Here Is my code:

url 'https://api.darksky.net/forecast/e17c10c93f30ea8c4c6a4552b/'+str(latitude)+", "+str(longitude) res requests.get (url) read-res.json() 43 45 47 48 ID 0 temp-"[".format(read I currently'] ['temperature']) wind_speed-".format(read I'currently']['windSpeed']) humidity="{}", format ( read [ 'cu r rently' ] [ 'humidity' ] ) 50 51 52 53 54 forecasts [int(ID), float (wind_speed), float(temp), float (humidity)] #print ( forecasts) 56 57 58 59 60 61 62 63 64 65 cur conn.cursor() def create_table): cur.execute( 'CREATE TABLE IF NOT EXISTS wdata(ID INTEGER, wind_speed NUMERIC, temp NUMERIC, humidity NUMERIC)') def data_entry(): cur.executemany('INSERT INTO wdata values (?,7,?,7)',forecasts) conn.commit() 67 68 create table() data_entry()

Explanation / Answer

Hope this helps!