def _get_director_movies(self): if is_empty(self.get_id()): return None movies = filter_movies_from_credits(self.get_movie_credits()) if not is_empty(peek(movies)): return movies else: message = f"Cannot find any movies directed by {self.name}" logging.error(message); print(message) return None
def _is_name_empty(self): if is_empty(self.name): message = "Person name cannot be empty" logging.error(message) print(message) return True
def get_person_id(self): if not is_empty(self._data): return str(self._data[KEYS.ID]) else: message = f"Cannot get Id for {self.name}" logging.error(message) print(message) return None
def list_movies(self): if not is_empty(self.movies): print(f"List of movies directed by {self.name} \n") for movie in self.movies: print(movie) else: message = f"Cannot find any movies directed by {self.name}" logging.error(message); print(message)
def parse_response(self): if not is_empty(self.data): result = json_parser(self.data.content) if not result: return None else: return result else: return None
def parse_response(self): if not is_empty(self.data): result = json_parser(self.data.content)['results'] if not result: return None else: return result[0] # ^ # We select the first (best) match out of list of people # matching the search query else: return None
def _get_person_movie_credits(self): if is_empty(self.id): return None return GetPersonMovieCreditsResponse( dao.get_person_movie_credits(self.id)).movie_credits
def _get_person_id(self): if is_empty(self.data): return None return self.data.id