From 6290d5becf2c597a8f7fa88a08e0a4e7f63e1697 Mon Sep 17 00:00:00 2001
From: "Kamalendran, Kobi (UG - Computer Science)" <kk00515@surrey.ac.uk>
Date: Fri, 12 Mar 2021 14:00:53 +0000
Subject: [PATCH] Fixed import errors

---
 movies.py    | 7 +++----
 showtimes.py | 7 +++----
 2 files changed, 6 insertions(+), 8 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..76a98b6 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",
@@ -24,7 +23,7 @@ def hello():
 
 @app.route("/showtimes", methods=['GET'])
 def showtimes_list():
-    nice_json(showtimes)
+    return json.dumps(showtimes)
 
 
 @app.route("/showtimes/<date>", methods=['GET'])
@@ -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