From cd15085fd2791b0e809df41c70ac579f80064fc2 Mon Sep 17 00:00:00 2001 From: Umer Mansoor <umermk3@gmail.com> Date: Thu, 10 Dec 2015 22:24:19 -0700 Subject: [PATCH] added GET method to Flask routes --- services/bookings.py | 6 +++--- services/movies.py | 6 +++--- services/showtimes.py | 6 +++--- services/user.py | 10 +++++----- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/services/bookings.py b/services/bookings.py index b03964d..6cf957a 100644 --- a/services/bookings.py +++ b/services/bookings.py @@ -10,7 +10,7 @@ with open("{}/database/bookings.json".format(root_dir()), "r") as f: bookings = json.load(f) -@app.route("/") +@app.route("/", methods=['GET']) def hello(): return nice_json({ "uri": "/", @@ -21,12 +21,12 @@ def hello(): }) -@app.route("/bookings") +@app.route("/bookings", methods=['GET']) def booking_list(): return nice_json(bookings) -@app.route("/bookings/<username>") +@app.route("/bookings/<username>", methods=['GET']) def booking_record(username): if username not in bookings: raise NotFound diff --git a/services/movies.py b/services/movies.py index 8bcf8ab..b9907dd 100644 --- a/services/movies.py +++ b/services/movies.py @@ -10,7 +10,7 @@ with open("{}/database/movies.json".format(root_dir()), "r") as f: movies = json.load(f) -@app.route("/") +@app.route("/", methods=['GET']) def hello(): return nice_json({ "uri": "/", @@ -20,7 +20,7 @@ def hello(): } }) -@app.route("/movies/<movieid>") +@app.route("/movies/<movieid>", methods=['GET']) def movie_info(movieid): if movieid not in movies: raise NotFound @@ -31,7 +31,7 @@ def movie_info(movieid): return nice_json(result) -@app.route("/movies") +@app.route("/movies", methods=['GET']) def movie_record(): return nice_json(movies) diff --git a/services/showtimes.py b/services/showtimes.py index 3a08fde..b6c622d 100644 --- a/services/showtimes.py +++ b/services/showtimes.py @@ -10,7 +10,7 @@ with open("{}/database/showtimes.json".format(root_dir()), "r") as f: showtimes = json.load(f) -@app.route("/") +@app.route("/", methods=['GET']) def hello(): return nice_json({ "uri": "/", @@ -21,12 +21,12 @@ def hello(): }) -@app.route("/showtimes") +@app.route("/showtimes", methods=['GET']) def showtimes_list(): return nice_json(showtimes) -@app.route("/showtimes/<date>") +@app.route("/showtimes/<date>", methods=['GET']) def showtimes_record(date): if date not in showtimes: raise NotFound diff --git a/services/user.py b/services/user.py index 9add38c..17edad2 100644 --- a/services/user.py +++ b/services/user.py @@ -11,7 +11,7 @@ with open("{}/database/users.json".format(root_dir()), "r") as f: users = json.load(f) -@app.route("/") +@app.route("/", methods=['GET']) def hello(): return nice_json({ "uri": "/", @@ -24,12 +24,12 @@ def hello(): }) -@app.route("/users") +@app.route("/users", methods=['GET']) def users_list(): return nice_json(users) -@app.route("/users/<username>") +@app.route("/users/<username>", methods=['GET']) def user_record(username): if username not in users: raise NotFound @@ -37,7 +37,7 @@ def user_record(username): return nice_json(users[username]) -@app.route("/users/<username>/bookings") +@app.route("/users/<username>/bookings", methods=['GET']) def user_bookings(username): """ Gets booking information from the 'Bookings Service' for the user, and @@ -77,7 +77,7 @@ def user_bookings(username): return nice_json(result) -@app.route("/users/<username>/suggested") +@app.route("/users/<username>/suggested", methods=['GET']) def user_suggested(username): """ Returns movie suggestions. The algorithm returns a list of 3 top ranked -- GitLab