data_collection/gazette/spiders/pr_curitiba.py
def parse_page(self, response):
        """Parses list of gazettes.

        Extra editions can already have its item built. Regular editions need an extra
        request.
        """
        for idx, row in enumerate(response.css(".grid_Row")):
            pdf_date = row.css("td:nth-child(2) span ::text").extract_first()
            gazette_id = row.css("td:nth-child(3) a ::attr(data-teste)").extract_first()
            parsed_date = parse(f"{pdf_date}", languages=["pt"]).date()
            eventtarget = row.css("td:nth-child(3) a ::attr(href)").re_first(
                "'(.*lnkVisualizar)'"
            )
            if gazette_id == "0":
                yield scrapy.FormRequest.from_response(
                    response,
                    formdata={"__EVENTTARGET": eventtarget},
                    callback=self.parse_regular_edition,
                    meta={"parsed_date": parsed_date},
                )
            else:
                yield Gazette(
                    date=parsed_date,
                    file_urls=[
                        f"https://legisladocexterno.curitiba.pr.gov.br/DiarioSuplementoConsultaExterna_Download.aspx?Id={gazette_id}"
                    ],
                    is_extra_edition=True,
                    power="executive_legislative",
                )
Parses list of gazettes.

        Extra editions can already have its item built. Regular editions need an extra
        request.
        
Parses list of gazettes.
Extra editions can already have its item built. Regular editions need an extra
request.
Parses list of gazettes . Extra editions can already have its item built . Regular editions need an extra request .
def parse_page(self, response):
        for idx, row in enumerate(response.css(".grid_Row")):
            pdf_date = row.css("td:nth-child(2) span ::text").extract_first()
            gazette_id = row.css("td:nth-child(3) a ::attr(data-teste)").extract_first()
            parsed_date = parse(f"{pdf_date}", languages=["pt"]).date()
            eventtarget = row.css("td:nth-child(3) a ::attr(href)").re_first(
                "'(.*lnkVisualizar)'"
            )
            if gazette_id == "0":
                yield scrapy.FormRequest.from_response(
                    response,
                    formdata={"__EVENTTARGET": eventtarget},
                    callback=self.parse_regular_edition,
                    meta={"parsed_date": parsed_date},
                )
            else:
                yield Gazette(
                    date=parsed_date,
                    file_urls=[
                        f"https://legisladocexterno.curitiba.pr.gov.br/DiarioSuplementoConsultaExterna_Download.aspx?Id={gazette_id}"
                    ],
                    is_extra_edition=True,
                    power="executive_legislative",
                )
def parse_page ( self , response ) : for idx , row in enumerate ( response . css ( ".grid_Row" ) ) : pdf_date = row . css ( "td:nth-child(2) span ::text" ) . extract_first ( ) gazette_id = row . css ( "td:nth-child(3) a ::attr(data-teste)" ) . extract_first ( ) parsed_date = parse ( f"{pdf_date}" , languages = [ "pt" ] ) . date ( ) eventtarget = row . css ( "td:nth-child(3) a ::attr(href)" ) . re_first ( "'(.*lnkVisualizar)'" ) if gazette_id == "0" : yield scrapy . FormRequest . from_response ( response , formdata = { "__EVENTTARGET" : eventtarget } , callback = self . parse_regular_edition , meta = { "parsed_date" : parsed_date } , ) else : yield Gazette ( date = parsed_date , file_urls = [ f"https://legisladocexterno.curitiba.pr.gov.br/DiarioSuplementoConsultaExterna_Download.aspx?Id={gazette_id}" ] , is_extra_edition = True , power = "executive_legislative" , )
Parses list of gazettes.
Parses list of gazettes .
"""Parses list of gazettes.

        Extra editions can already have its item built. Regular editions need an extra
        request.
        """
self
response