def add_all_movies(self): local_http = http.request('GET', self._movies_url) date = BeautifulSoup(local_http.data, 'html.parser').find('a', attrs={ 'class': 'selected' }).text[:5] year = str(date) + "." + str(current_year) for movie in self.get_all_movies(): local_soup = BeautifulSoup(str(movie), 'html.parser') movie_name = local_soup.find('h5').text try: self._movies[movie_name]['projections'] except KeyError: if movie_name in Movie.all_movies: self._movies[movie_name] = Movie.all_movies[movie_name] else: time.sleep(10) movie = Movie(url=home + local_soup.a['href']) movie.load_movie(movie_name) self._movies[str(movie)] = movie.__dict__ row = local_soup.find_all('div', attrs={'class': 'row'}) for current in row: mini_soup = BeautifulSoup(str(current), 'html.parser') attributes = [] for image in mini_soup.find_all('img'): if image['alt']: attributes.append(image['alt']) if attributes: for item in current.find('div', attrs={ 'class': 'timelineSet' }).text.split(): try: self._movies[str(movie)]['projections'].append({ 'features': attributes, 'projection': item, 'date': year }) except KeyError: self._movies[movie_name]['projections'].append({ 'features': attributes, 'projection': item, 'date': year })