
Modify the data.py file (don’t change the main.py)
Make a get() request to fetch 10 True or False questions.
Parse the JSON response and replace the value of question_data (don’t change the variable name)
Hint: create a Python dictionary for the amount and type parameters.
import requests
URL = "https://opentdb.com/api.php?amount=10&category=18&difficulty=medium&type=boolean"
response = requests.get(URL)
response.raise_for_status
data = response.json()
#print(data["results"])
question_data = data["results"]