forked from LaunchCode-Education-Archived/flicklist-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
27 lines (18 loc) · 657 Bytes
/
main.py
File metadata and controls
27 lines (18 loc) · 657 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import webapp2
import random
class Index(webapp2.RequestHandler):
def getRandomMovie(self):
# list of movies to select from
movies = ["The Big Lebowski", "Blue Velvet", "Toy Story", "Star Wars", "Amelie"]
# randomly choose one of the movies
randomIdx = random.randrange(len(movies))
return movies[randomIdx]
def get(self):
movie = self.getRandomMovie()
# build the response string
response = "<h1>Movie of the Day</h1>"
response += "<ul><li>" + movie + "</li></ul>"
self.response.write(response)
app = webapp2.WSGIApplication([
('/', Index)
], debug=True)