Question: Define the function getValidMoviesData that: accepts a list of movie titles Uses the getMoviesData function to return a list of valid movie dictionaries. This


Define the function getValidMoviesData that: accepts a list of movie titles Uses the getMoviesData function to return a list of valid movie dictionaries. This function needs to test the return value from getMovies Data to filter out any False return values. def getValidMovies Data (movieTitles): return None # Run this cell to test the function for movie in getValid MoviesData(["Superbabies: Baby Geniuses 2", "The Shawshank Redemption", "Foobarbat", "asdfasdfasdfasdfasdf" "Thor"]): print (movie [ 'Title'], movie [ 'Year']) 3 def getOMDBData(title, apikey): url = 'https://www.omdbapi.com/' params = {'t': title, 'apikey': apikey} try: response = requests.get(url, params-params) data response.json () if data[ 'Response'] == 'False': return false return data except: return False def getMoviesData (movieTitles): apikey= 'apikey' movies = [] for title in movieTitles: movie_data = getOMDBData (title, apikey) if movie_data: movies.append(movie_data) return movies
Step by Step Solution
There are 3 Steps involved in it
You can define the getValidMoviesData function as follows import requests def getOMDBDatatitle apike... View full answer
Get step-by-step solutions from verified subject matter experts
