Skip to content

Instantly share code, notes, and snippets.

@jasongorman
Created December 12, 2019 11:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasongorman/01f893f3c4730fa956e81c126a80e7bb to your computer and use it in GitHub Desktop.
Save jasongorman/01f893f3c4730fa956e81c126a80e7bb to your computer and use it in GitHub Desktop.
class Pricer(object):
def price(self, imdbID):
rating, title = self.fetch_video_info(imdbID)
price = 3.95
if rating > 7:
price += 1.0
if rating < 4:
price -= 1.0
return Video(imdbID, title, rating, price)
def fetch_video_info(self, imdbID):
response = requests.get("http://www.omdbapi.com/?i=" + imdbID + "&apikey=6487ec62")
json = response.json()
title = json["Title"]
rating = float(json["imdbRating"])
return rating, title
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment