Skip to content
Snippets Groups Projects
Commit 0c3d436b authored by Diccion, Kaeren C (UG - Computer Science)'s avatar Diccion, Kaeren C (UG - Computer Science)
Browse files

Update showtimes.py

parent d92f3e5e
No related branches found
No related tags found
No related merge requests found
from services import root_dir, nice_json #from services import root_dir, nice_json
from flask import Flask from flask import Flask
from werkzeug.exceptions import NotFound from werkzeug.exceptions import NotFound
import json import json
...@@ -13,7 +13,7 @@ with open("{}/database/showtimes.json".format(os.getcwd()), "r") as f: ...@@ -13,7 +13,7 @@ with open("{}/database/showtimes.json".format(os.getcwd()), "r") as f:
@app.route("/", methods=['GET']) @app.route("/", methods=['GET'])
def hello(): def hello():
return nice_json({ return json.dump({
"uri": "/", "uri": "/",
"subresource_uris": { "subresource_uris": {
"showtimes": "/showtimes", "showtimes": "/showtimes",
...@@ -24,7 +24,7 @@ def hello(): ...@@ -24,7 +24,7 @@ def hello():
@app.route("/showtimes", methods=['GET']) @app.route("/showtimes", methods=['GET'])
def showtimes_list(): def showtimes_list():
nice_json(showtimes) json.dump(showtimes)
@app.route("/showtimes/<date>", methods=['GET']) @app.route("/showtimes/<date>", methods=['GET'])
...@@ -32,7 +32,7 @@ def showtimes_record(date): ...@@ -32,7 +32,7 @@ def showtimes_record(date):
if date not in showtimes: if date not in showtimes:
raise NotFound raise NotFound
print(showtimes[date]) print(showtimes[date])
return nice_json(showtimes[date]) return json.dump(showtimes[date])
if __name__ == "__main__": if __name__ == "__main__":
app.run(port=5002, debug=True) app.run(port=5002, debug=True)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment