Final Project API
Using API in our final project
from flask import Blueprint, jsonify # jsonify creates an endpoint response object
from flask_restful import Api, Resource # used for REST API building
import requests # used for testing
url = "https://opentdb.com/api.php?amount=10&category=19&difficulty=medium&type=multiple"
response = requests.request("GET", url)
quiz_data = response
print(quiz_data.text)
print(quiz_data.json())
results = quiz_data.json().get('results')
def IndividualQuestion(a):
a = results
count = 0
for i in a:
q = results[count]
count += 1
print(q['question'])
IndividualQuestion(results)
#print(results[1])
#question_1 = results[1]
#print(question_1["question"])