class Caller(): def __init__(self): self.tmdb_manager = TMDBManager() self.storer = Storer() def check(self, key): """ Check if data is present in bloom filter True means the data has been added to the mysql table Implies no api call Otherwise api call. """ return Filter.check(key) def call_tmdb(self, movie): """ Api call for the movie takes place """ d_dict = {} personlist = [] try: d_dict = self.tmdb_manager.movie_info(movie) personlist = self.tmdb_manager.person_info(d_dict) except Exception, e: try: movie = movie.replace(movie.split(" ")[-1], "") d_dict = self.tmdb_manager.movie_info(movie) personlist = self.tmdb_manager.person_info(d_dict) except Exception as e: print sys.exc_info()[0] return d_dict, personlist
def __init__(self): self.tmdb_manager = TMDBManager() self.storer = Storer()