Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uk_fts: temp replace python 1e9999 values #593

Merged
merged 1 commit into from
Jan 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion kingfisher_scrapy/spiders/uk_fts.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import scrapy

from kingfisher_scrapy.base_spider import LinksSpider
from kingfisher_scrapy.util import parameters
from kingfisher_scrapy.util import parameters, handle_http_error


class UKFTS(LinksSpider):
Expand Down Expand Up @@ -32,3 +32,12 @@ def start_requests(self):
url = f'{url}?updatedFrom={self.from_date}&updatedTo={self.until_date}'

yield scrapy.Request(url, meta={'file_name': 'start.json'}, headers={'Accept': 'application/json'})

@handle_http_error
def parse(self, response):
data = response.text
# TODO: temporary fix for https://github.com/open-contracting/kingfisher-process/issues/323, remove when it's
# solved in kingfisher process
data = data.replace('1e9999', '9999999')
response = response.replace(body=data)
yield from super().parse(response)