From 759f94d4050a810d857c706b2bc8b1c6e8b3f6e4 Mon Sep 17 00:00:00 2001 From: Yohanna Lisnichuk Date: Tue, 30 Jun 2020 07:49:02 -0400 Subject: [PATCH] Chile: Include full response as error message Signed-off-by: Yohanna Lisnichuk --- kingfisher_scrapy/spiders/chile_base.py | 3 ++- kingfisher_scrapy/spiders/chile_compra_bulk.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/kingfisher_scrapy/spiders/chile_base.py b/kingfisher_scrapy/spiders/chile_base.py index 268fe747..77d1b3dd 100644 --- a/kingfisher_scrapy/spiders/chile_base.py +++ b/kingfisher_scrapy/spiders/chile_base.py @@ -48,7 +48,8 @@ def parse_list(self, response): # "detail": "error" # } if 'status' in data and data['status'] != 200: - yield self.build_file_error_from_response(response, errors={'http_code': data['status']}) + data['http_code'] = data['status'] + yield self.build_file_error_from_response(response, errors=data) return for item in data['data']: diff --git a/kingfisher_scrapy/spiders/chile_compra_bulk.py b/kingfisher_scrapy/spiders/chile_compra_bulk.py index 07b4f9d4..75db76f7 100644 --- a/kingfisher_scrapy/spiders/chile_compra_bulk.py +++ b/kingfisher_scrapy/spiders/chile_compra_bulk.py @@ -40,9 +40,10 @@ def build_file(self, file_name=None, url=None, data=None, data_type=None, encodi # "detail": "error" # } if 'status' in json_data and json_data['status'] != 200: + json_data['http_code'] = json_data['status'] return FileError({ 'url': url, - 'errors': {'http_code': json_data['status']}, + 'errors': json_data, }) else: return super().build_file(data=data, file_name=file_name, url=url, data_type=data_type, encoding=encoding)