def build_results(self):
        self.header("Scraping election candidates")

        url = urlparse.urljoin(
            self.base_url,
            '/Campaign/Candidates/list.aspx?view=certified&electNav=93'
        )
        soup = self.get(url)

        # Get all the links out
        links = soup.findAll('a', href=re.compile(r'^.*&electNav=\d+'))

        # Drop the link that says "prior elections" because it's a duplicate
        links = [
            l for l in links
            if l.find_next_sibling('span').text != 'Prior Elections'
        ]

        # Loop through the links...
        results = []
        for i, link in enumerate(links):
            # .. go and get each page and its data
            url = urlparse.urljoin(self.base_url, link["href"])
            data = self.scrape_page(url)
            # Parse out the name and year
            data['raw_name'] = link.find_next_sibling('span').text.strip()
            data['election_type'] = self.parse_election_name(data['raw_name'])
            data['year'] = int(data['raw_name'][:4])
            # The index value is used to preserve sorting of elections,
            # since multiple elections may occur in a year.
            # BeautifulSoup goes from top to bottom,
            # but the top most election is the most recent so it should
            # have the highest id.
            data['sort_index'] = len(links) - i
            # Add it to the list
            results.append(data)
            # Take a rest
            sleep(0.5)

        # Pass out the data
        return results
dataset/ETHPy150Open california-civic-data-coalition/django-calaccess-campaign-browser/calaccess_campaign_browser/management/commands/scrapecalaccesscampaigncandidates.py/Command.build_results/original