Ejemplo n.º 1
0
def create_score():
    if not request.json or not 'name' in request.json:
        abort(400)
    newName = request.json['name']
    newPoints = request.json['points']
    highscore.newHighscore(newName, newPoints)
#    newscore = {
#        'name': newName,
#        'points': newPoints,
#    }
    scores = highscore.printHighscore()
    if len(scores) == 0:
        abort(404)
    else:
        return jsonify({'scores': scores})
Ejemplo n.º 2
0
def get_scores():
    scores = highscore.printHighscore()
    if len(scores) == 0:
        abort(404)
    else:
        return jsonify({'scores': scores})