From e2234f1cdd59dc3a3aed1dc7f471a0ded80a3644 Mon Sep 17 00:00:00 2001 From: trevineju Date: Wed, 12 Jun 2024 15:30:15 -0300 Subject: [PATCH] Atualiza formato de url para base Instar --- .../gazette/spiders/base/instar.py | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/data_collection/gazette/spiders/base/instar.py b/data_collection/gazette/spiders/base/instar.py index 4bc3fc086..07b4a4240 100644 --- a/data_collection/gazette/spiders/base/instar.py +++ b/data_collection/gazette/spiders/base/instar.py @@ -13,14 +13,8 @@ def start_requests(self): start_date = self.start_date.strftime("%d-%m-%Y") end_date = self.end_date.strftime("%d-%m-%Y") - start_url = "{base_url}/{page}/{start_date}/{end_date}/0/0/0".format( - **{ - "base_url": self.base_url, - "page": page, - "start_date": start_date, - "end_date": end_date, - } - ) + start_url = f"{self.base_url}/{page}/{start_date}/{end_date}/0/0/" + yield scrapy.Request( start_url, cb_kwargs={"page": page, "start_date": start_date, "end_date": end_date}, @@ -34,15 +28,9 @@ def _pagination_requests(self, response, page, start_date, end_date): for next_page in range(2, total_pages + 1): next_page_url = ( - "{base_url}/{page}/{start_date}/{end_date}/0/0/0".format( - **{ - "base_url": self.base_url, - "page": next_page, - "start_date": start_date, - "end_date": end_date, - } - ) + f"{self.base_url}/{next_page}/{start_date}/{end_date}/0/0/" ) + yield scrapy.Request( next_page_url, cb_kwargs={