From 5f8b89d9ea1653d253a7847b8b6cacd876b855e3 Mon Sep 17 00:00:00 2001 From: Rizwan Khalid <rk00436@surrey.ac.uk> Date: Fri, 12 Mar 2021 13:35:11 +0000 Subject: [PATCH] Replaced nice_json with json.dumps --- movies.py | 7 +++---- showtimes.py | 5 ++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/movies.py b/movies.py index 9f6a2e2..0b6f76e 100644 --- a/movies.py +++ b/movies.py @@ -1,4 +1,3 @@ -from services import root_dir, nice_json from flask import Flask from werkzeug.exceptions import NotFound import json @@ -11,7 +10,7 @@ with open("{}/database/movies.json".format(os.getcwd()), "r") as f: @app.route("/", methods=['GET']) def hello(): - return nice_json({ + return json.dumps({ "uri": "/", "subresource_uris": { "movies": "/movies", @@ -27,12 +26,12 @@ def movie_info(movieid): result = movies[movieid] result["uri"] = "/movies/{}".format(movieid) - return nice_json(result) + return json.dumps(result) @app.route("/movies", methods=['GET']) def movie_record(): - return nice_json(movies) + return json.dumps(movies) if __name__ == "__main__": diff --git a/showtimes.py b/showtimes.py index f4d236c..ecfdbd3 100644 --- a/showtimes.py +++ b/showtimes.py @@ -1,4 +1,3 @@ -from services import root_dir, nice_json from flask import Flask from werkzeug.exceptions import NotFound import json @@ -13,7 +12,7 @@ with open("{}/database/showtimes.json".format(os.getcwd()), "r") as f: @app.route("/", methods=['GET']) def hello(): - return nice_json({ + return json.dumps({ "uri": "/", "subresource_uris": { "showtimes": "/showtimes", @@ -32,7 +31,7 @@ def showtimes_record(date): if date not in showtimes: raise NotFound print(showtimes[date]) - return nice_json(showtimes[date]) + return json.dumps(showtimes[date]) if __name__ == "__main__": app.run(port=5002, debug=True) -- GitLab