Skip to content

Instantly share code, notes, and snippets.

@0xPr0xy
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0xPr0xy/edb4b4f2f87c552fe25e to your computer and use it in GitHub Desktop.
Save 0xPr0xy/edb4b4f2f87c552fe25e to your computer and use it in GitHub Desktop.
api
from app import app, render_template, Response, jsonify
import json
@app.route('/')
def index():
return 'index'
@app.route('/single')
def getDoneQuiz():
json = {
"completed_question_fraction" : 1.0,
"date_created" : 1405585407,
"is_completed" : 1,
"labels" : [ "natuurkunde","vak063"],
"project_id" : 6,
"quiz_id" : 1,
"score_fraction" : 0.80000000000000004,
"score_value" : 4,
"session_id" : 234987,
"user_id" : 23,
"value" : 5
}
return jsonify(json)
@app.route('/completed')
def getCompletedQuizzes():
jsonArray = [{
"completed_question_fraction" : 0.40000000000000002,
"date_created" : 1405586401,
"is_completed" : 0,
"labels" : [ "natuurkunde","vak063"],
"project_id" : 6,
"quiz_id" : 1,
"score_fraction" : 0.20000000000000001,
"score_value" : 1,
"session_id" : 234987,
"user_id" : 23,
"value" : 5
},
{ "completed_question_fraction" : 0.59999999999999998,
"date_created" : 1405587278,
"is_completed" : 0,
"labels" : [ "natuurkunde","vak063"],
"project_id" : 6,
"quiz_id" : 1,
"score_fraction" : 0.40000000000000002,
"score_value" : 2,
"session_id" : 234987,
"user_id" : 78,
"value" : 5
}]
return Response(json.dumps(jsonArray), mimetype='application/json')
@app.route('/uncompleted')
def getUncompletedQuizzes():
jsonArray = [{
"completed_question_fraction" : 0.40000000000000002,
"date_created" : 1405586401,
"is_completed" : 0,
"labels" : [ "natuurkunde","vak063"],
"project_id" : 6,
"quiz_id" : 1,
"score_fraction" : 0.20000000000000001,
"score_value" : 1,
"session_id" : 234987,
"user_id" : 23,
"value" : 5
},
{ "completed_question_fraction" : 0.59999999999999998,
"date_created" : 1405587278,
"is_completed" : 0,
"labels" : [ "natuurkunde","vak063"],
"project_id" : 6,
"quiz_id" : 1,
"score_fraction" : 0.40000000000000002,
"score_value" : 2,
"session_id" : 234987,
"user_id" : 78,
"value" : 5
}]
return Response(json.dumps(jsonArray), mimetype='application/json')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment