I looped through a json file and then used the corresponding data taken from the json file to obtain phone numbers using a skip tracing API. I have the response.json printed out after making the API call. How can I take the data that was output and put it into a dataframe? Do I need to change the code and make the API call again, or can I do this without making another API call? See attached picture and code below:
# Define the API endpointurl = "https://skip-trace1.p.rapidapi.com/byAddress"# Define headers for the API requestheaders = {"X-RapidAPI-Key": "notshownhere","X-RapidAPI-Host": "notshown"}# Iterate through the data in the JSON filefor item in data: # Extract streetAddress, city, and state from each item street_address = item["Address"] city = item["City"] state = item["State"] # Define the query parameters querystring = {"streetAddress": street_address, "city": city, "state": state} # Make the API request response = requests.get(url, headers=headers, params=querystring) # Print the API response print(response.json())
I have tried taking the response.json and saving it into a json file, but I have gotten errors. I can't seem to access the info obtained from printing the response.json again.