Skip to content

Commit

Permalink
united_kingdom_fts: Use a comparable name, if until_date isn't set
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Sep 19, 2023
1 parent a9f2cb4 commit d0d5512
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions kingfisher_scrapy/spiders/united_kingdom_fts.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ class UnitedKingdomFTS(LinksSpider):

def start_requests(self):
url = 'https://www.find-tender.service.gov.uk/api/1.0/ocdsReleasePackages'
file_name = 'start.json'
if self.from_date and self.until_date:
from_date = self.from_date.strftime(self.date_format)
until_date = self.until_date.strftime(self.date_format)
url = f'{url}?updatedFrom={from_date}&updatedTo={until_date}'
file_name = f'{from_date}-{until_date}-{file_name}'

yield scrapy.Request(url, meta={'file_name': file_name}, headers={'Accept': 'application/json'})
else:
until_date = self.get_default_until_date().strftime(self.date_format)
yield scrapy.Request(url, meta={'file_name': f'{until_date}.json'}, # reverse chronological order
headers={'Accept': 'application/json'})

@handle_http_error
def parse(self, response):
Expand Down

0 comments on commit d0d5512

Please sign in to comment.