Skip to content

Commit

Permalink
Set interval limit for end date
Browse files Browse the repository at this point in the history
  • Loading branch information
ddevdan committed Aug 7, 2024
1 parent 70d5b10 commit 8c275fb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion data_collection/gazette/spiders/base/barcodigital.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,15 @@ def start_requests(self):
def parse(self, response):
for documents in response.json().values():
for document in documents:
document_date = datetime.strptime(
document.get("data"), "%Y-%m-%d"
).date()

if document_date > self.end_date:
continue

yield Gazette(
date=datetime.strptime(document.get("data"), "%Y-%m-%d").date(),
date=document_date,
edition_number=document.get("edicao"),
is_extra_edition=document.get("tipo_edicao_id")
!= self.EDITION_TYPE_NORMAL,
Expand Down

0 comments on commit 8c275fb

Please sign in to comment.