diff --git a/quizz.py b/quizz.py index f95d1889e0a31a8bed7b8aa313339e218fd9e9f7..5268800a6a2abddc79fe503a73bc7e26dc133e2d 100644 --- a/quizz.py +++ b/quizz.py @@ -6,15 +6,16 @@ from random import shuffle def quizz() : req = requests.get("https://opentdb.com/api.php?amount=1&difficulty=easy") al = req.json() + pas_reponse = [] rep= al['results'][0] - question = rep['question'] - reponse= rep['correct_answer'] + question = urllib.unquote(rep['question']) + reponse= urllib.unquote(rep['correct_answer']) choix = [reponse.encode('utf8')] for f in rep['incorrect_answers'] : urllib.unquote(f) + pas_reponse.append(f.encode('utf8')) choix.append(f.encode('utf8')) shuffle(choix) - return {'question' : question.encode('utf8'), 'reponse' : reponse.encode('utf8'), 'choix' : choix} - + return {'question' : question.encode('utf8'), 'reponse' : reponse.encode('utf8'), 'choix' : choix, 'pas_reponse' : pas_reponse }