Goals: what you will make by the end of the day (2)

Open Trivia DB

Untitled

Trivia Question API Challenge (6)

  1. Modify the data.py file (don’t change the main.py)

  2. Make a get() request to fetch 10 True or False questions.

  3. Parse the JSON response and replace the value of question_data (don’t change the variable name)

  4. Hint: create a Python dictionary for the amount and type parameters.

Solution & Walkthrough for getting Trivia Questions (4)

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"]

Unescaping HTML Entitles (4)

HTML Entities