Skip to content

Commit

Permalink
Chile: Include full response as error message
Browse files Browse the repository at this point in the history
Signed-off-by: Yohanna Lisnichuk <yohanitalisnichuk@gmail.com>
  • Loading branch information
yolile committed Jun 30, 2020
1 parent c895757 commit 759f94d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion kingfisher_scrapy/spiders/chile_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']:
Expand Down
3 changes: 2 additions & 1 deletion kingfisher_scrapy/spiders/chile_compra_bulk.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 759f94d

Please sign in to comment.