From f9c605db5f2325d8ec2050815c79687492e03f8f Mon Sep 17 00:00:00 2001 From: "Aung, Htet (PG/T - Comp Sci & Elec Eng)" <ha02133@surrey.ac.uk> Date: Fri, 21 Mar 2025 12:33:57 +0000 Subject: [PATCH] Edit showtimes.py --- showtimes.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/showtimes.py b/showtimes.py index e9ff629..0810d3e 100644 --- a/showtimes.py +++ b/showtimes.py @@ -28,11 +28,20 @@ def showtimes_list(): @app.route("/showtimes/<date>", methods=['GET']) + + +movies_service = "http://127.0.0.1:5001/movies/{}" #we know this is where the service is running. We replace the {} with the actual ID of the movie we want. + def showtimes_record(date): if date not in showtimes: raise NotFound print(showtimes[date]) - return nice_json(showtimes[date]) + result = [] + for movie_id in showtimes[date]: + resp = requests.get(movies_service.format(movie_id)) + result.append(resp.json()["title"]) + return nice_json(result) + if __name__ == "__main__": app.run(port=5002, debug=True) -- GitLab