Esempio n. 1
0
 def person_from_td(self, td):
     for link in pqitems(td, 'a'):
         href = link.attr('href')
         if href.startswith('http://www.cdep.ro/pls/'
                            'parlam/structura.mp?'):
             (year, number) = parse_cdep_id(href)
             return (link.text(), year, number)
Esempio n. 2
0
    def parse_mandates(self, table, ended=False):
        for row in list(table.children().items())[2:]:
            cols = row.children()
            link = cols.eq(1).find('a')
            (mandate_year, cdep_number) = parse_cdep_id(link.attr('href'))

            mandate = Mandate(
                year=mandate_year,
                cdep_number=cdep_number,
                person_name=link.text(),
                minority=False,
                end_date=None
            )

            if cols.eq(2).text() == "ales la nivel naţional":
                mandate.minority = True

            else:
                mandate.constituency = int(cols.eq(2).text())
                mandate.college = int(cols.eq(4).text())
                mandate.party_name = cols.eq(5).text()

                county_name = fix_local_chars(cols.eq(3).text().title())
                if county_name == "Bistrița-Năsăud":
                    county_name = "Bistrița Năsăud"
                mandate.county_name = county_name

            if ended:
                mandate.end_date = parse_date(cols.eq(6).text())

            yield mandate
Esempio n. 3
0
    def parse_mandates(self, table, ended=False):
        for row in list(table.children().items())[2:]:
            cols = row.children()
            link = cols.eq(1).find('a')
            (mandate_year, cdep_number) = parse_cdep_id(link.attr('href'))

            mandate = Mandate(year=mandate_year,
                              cdep_number=cdep_number,
                              person_name=link.text(),
                              minority=False,
                              end_date=None)

            if cols.eq(2).text() == "ales la nivel naţional":
                mandate.minority = True

            else:
                mandate.constituency = int(cols.eq(2).text())
                mandate.college = int(cols.eq(4).text())
                mandate.party_name = cols.eq(5).text()

                county_name = fix_local_chars(cols.eq(3).text().title())
                if county_name == "Bistrița-Năsăud":
                    county_name = "Bistrița Năsăud"
                mandate.county_name = county_name

            if ended:
                mandate.end_date = parse_date(cols.eq(6).text())

            yield mandate
Esempio n. 4
0
 def person_from_td(self, td):
     for link in pqitems(td, 'a'):
         href = link.attr('href')
         if href.startswith('http://www.cdep.ro/pls/'
                            'parlam/structura.mp?'):
             (year, number) = parse_cdep_id(href)
             return (link.text(), year, number)