Question: Why won't my URL info fill in my sql table (python) Code creates the data table from sql but doesn't appear to grab anything from

Why won't my URL info fill in my sql table (python)

  • Code creates the data table from sql but doesn't appear to grab anything from the url for example there's no information in the "job, title, location ect. tabs of the sql database made from the code

import json import urllib import sqlite3 import temp def loading(): url = 'https://jobs.github.com/positions.json?page=1' # URL for API 1-5json_obj = urllib.urlopen(url) response = urllib.urlopen(url) data = json.load(response) # loads the url and set it into data variable for item in data[0].keys(): print(item) return data # Get the keys # def loading(): # print " LOADING API(s)" # urllib.urlopen('https://jobs.github.com/positions.json?page=1') # temp = json.dumps(data[1]) # print (json.dumps(data[1])) # print (" ") def createDB(data): conn = sqlite3.connect('example.db') c = conn.cursor() # Create table c.execute('''CREATE TABLE example (description text, title text, url text, company_logo text, company text, id integer primary key, company_url text, how_to_apply text, location text, type text, created_at timestamp)''') temp_values = list(tuple()) for item in temp: list_of_values = [v for k, v in item.items()] tuple_of_values = tuple(list_of_values) temp_values.append(tuple_of_values) c.executemany('INSERT INTO table_name VALUES (?,?,?,?,?,?,?,?,?,?,?)', temp_values) def main(): data = loading() createDB(data) main() 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!