def Crawler(nth, level): print level election_id = get_election_id(nth) valid_election_type_ids = get_valid_election_type_ids(election_id) if get_election_type_id(level) not in valid_election_type_ids: type_names = [reversed_election_types[t]\ for t in valid_election_type_ids] raise Exception('Not valid election type for this election_id: %s'\ % ','.join(type_names)) if level in ['province_governor', 'education_governor']: crawler = CandCrawler(nth, level) else: crawler = OtherCandCrawler(nth, level) return crawler
def Crawler(nth, level): print level election_id = get_election_id(nth) valid_election_type_ids = get_valid_election_type_ids(election_id) if get_election_type_id(level) not in valid_election_type_ids: type_names = [reversed_election_types[t]\ for t in valid_election_type_ids] raise Exception('Not valid election type for this election_id: %s'\ % ','.join(type_names)) if level in ['province_governor', 'province_proportional']: crawler = ElectedCrawler(nth, level) else: crawler = OtherElectedCrawler(nth, level) return crawler
def url_city_ids_json(self): return 'http://info.nec.go.kr/bizcommon/selectbox/selectbox_cityCodeBySgJson_Old.json?electionId=0000000000&electionCode=%s' % get_election_id( self.nth)