from flask import Flask, jsonify, abort, make_response

app = Flask(__name__)

tasks = [
    {
        'id': 1,
        'title': u'Buy groceries',
        'description': u'Milk, Cheese, Pizza, Fruit, Tylenol',
        'done': False
    },
    {
        'id': 2,
        'title': u'Learn Python',
        'description': u'Need to find a good Python tutorial on the web',
        'done': False
    }
]

@app.route('/')
def index():
    return "Hello, world!"

@app.route('/todo/api/v1.0/tasks/<int:task_id>', methods=['GET'])
def get_tasks(task_id):
    task = [task for task in tasks if task['id'] == task_id]
    if len(task) == 0:
        abort(404)
    return jsonify({'tasks': tasks[0]})

@app.errorhandler(404)
def not_found(error):
    return make_response(jsonify({'error': 'Not found'}), 404)

if __name__ == '__main__':
    app.run(debug=True)

@@ -33,16 +33,25 @@
 , abort,
+ request,
  make_re
@@ -57,16 +57,16 @@
 esponse%0A
-
 %0Aapp = F
@@ -460,16 +460,123 @@
 orld!%22%0A%0A
+@app.route('/todo/api/v1.0/tasks', methods=%5B'GET'%5D)%0Adef get_tasks():%0A    return jsonify(%7B'tasks': tasks%7D)%0A%0A
 @app.rou
@@ -645,17 +645,16 @@
 get_task
-s
 (task_id
@@ -759,16 +759,16 @@
 rt(404)%0A
-
     retu
@@ -796,24 +796,411 @@
 tasks%5B0%5D%7D)%0A%0A
+@app.route('/todo/api/v1.0/tasks', methods=%5B'POST'%5D)%0Adef create_task():%0A    if not request.json or not 'title' in request.json:%0A        abort(400)%0A    task = %7B%0A        'id': tasks%5B-1%5D%5B'id'%5D + 1,%0A        'title': request.json%5B'title'%5D,%0A        'description': request.json.get('description', %22%22),%0A        'done': False%0A    %7D%0A    tasks.append(task)%0A    return jsonify(%7B'task': task%7D), 201%0A%0A
 @app.errorha

create task