Beispiel #1
0
    def scrape_versions(self, chamber, session):
        chamber_letter = {"upper": "s", "lower": "h"}[chamber]
        versions_url = "ftp://ftp.cga.ct.gov/%s/tob/%s/" % (session, chamber_letter)

        with self.urlopen(versions_url) as page:
            files = parse_directory_listing(page)

            for f in files:
                match = re.match(r"^\d{4,4}([A-Z]+-\d{5,5})-(R\d\d)", f.filename)
                bill_id = match.group(1).replace("-", "")

                try:
                    bill = self.bills[bill_id]
                except KeyError:
                    continue

                url = versions_url + f.filename
                bill.add_version(match.group(2), url)
Beispiel #2
0
    def scrape_versions(self, chamber, session):
        chamber_letter = {'upper': 's', 'lower': 'h'}[chamber]
        versions_url = "ftp://ftp.cga.ct.gov/%s/tob/%s/" % (session,
                                                            chamber_letter)

        with self.urlopen(versions_url) as page:
            files = parse_directory_listing(page)

            for f in files:
                match = re.match(r'^\d{4,4}([A-Z]+-\d{5,5})-(R\d\d)',
                                 f.filename)
                bill_id = match.group(1).replace('-', '')

                try:
                    bill = self.bills[bill_id]
                except KeyError:
                    continue

                url = versions_url + f.filename
                bill.add_version(match.group(2), url)