download_source() with open('./challenges.html', 'r') as file: soup = BeautifulSoup(file.read(), 'html.parser') solutions_elements = soup.findAll('div', {'class': 'list-item solutions'}) # dict to store the challenges challenges = {'%d kyu' % n: [] for n in range(1, 9)} challenges['unrated'] = [] for solution_element in tqdm(solutions_elements, 'Parsing challenges'): parser = Parser(solution_element) challenge_id = parser.parse_id() # using codewars api to get info about the challenge response = requests.get(CHALLENGE_URL.format(challenge_id)) js = response.json() # creating a challenge object challenge = Challenge.fromjson(js) if challenge.kyu == None: challenge.kyu = 'unrated' challenge.code = parser.parse_code() challenge.language = parser.parse_language() challenges[challenge.kyu].append(challenge)