Skip to content
Extraits de code Groupes Projets
Valider 275de975 rédigé par Loris TICHADOU's avatar Loris TICHADOU
Parcourir les fichiers

Update quizz.py

parent 70ae8924
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -8,12 +8,13 @@ def quizz() : ...@@ -8,12 +8,13 @@ def quizz() :
al = req.json() al = req.json()
rep= al['results'][0] rep= al['results'][0]
question = urllib.unquote(rep['question']).encode('utf8') question = rep['question']
reponse= urllib.unquote(rep['correct_answer']).encode('utf8') reponse= rep['correct_answer']
choix = [urllib.unquote(rep['correct_answer']).encode('utf8')] choix = [reponse.encode('utf8')]
for f in rep['incorrect_answers'] : for f in rep['incorrect_answers'] :
choix.append(urllib.unquote(f)).encode('utf8') urllib.unquote(f)
choix.append(f.encode('utf8'))
shuffle(choix) shuffle(choix)
return {'question' : question, 'reponse' : reponse, 'choix' : choix} return {'question' : question.encode('utf8'), 'reponse' : reponse.encode('utf8'), 'choix' : choix}
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter