Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
COM3014 Microservices Lab 6
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Browne, Jesse (UG - Comp Sci & Elec Eng)
COM3014 Microservices Lab 6
Commits
cf30cd54
Commit
cf30cd54
authored
4 years ago
by
Sastry, Nishanth Prof (Comp Sci & Elec Eng)
Browse files
Options
Downloads
Patches
Plain Diff
Return movie names, not IDs, for day's showtimes
parent
59083e69
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
showtimes.py
+9
-2
9 additions, 2 deletions
showtimes.py
with
9 additions
and
2 deletions
showtimes.py
+
9
−
2
View file @
cf30cd54
...
@@ -2,12 +2,15 @@ from services import root_dir, nice_json
...
@@ -2,12 +2,15 @@ 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
import
requests
import
os
import
os
app
=
Flask
(
__name__
)
app
=
Flask
(
__name__
)
movies_service
=
"
http://127.0.0.1:5001/movies/{}
"
showtimes_db
=
f
"
{
os
.
getcwd
()
}
/database/showtimes.json
"
with
open
(
"
{}/database/showtimes.json
"
.
format
(
os
.
getcwd
())
,
"
r
"
)
as
f
:
with
open
(
showtimes_db
,
"
r
"
)
as
f
:
showtimes
=
json
.
load
(
f
)
showtimes
=
json
.
load
(
f
)
...
@@ -32,7 +35,11 @@ def showtimes_record(date):
...
@@ -32,7 +35,11 @@ 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
])
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__
"
:
if
__name__
==
"
__main__
"
:
app
.
run
(
port
=
5002
,
debug
=
True
)
app
.
run
(
port
=
5002
,
debug
=
True
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment