Skip to content

Commit

Permalink
fix(chile_compra_api_base): Use HTTPS. "status" is no longer set.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Jul 9, 2024
1 parent ffb553c commit 0a88662
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions kingfisher_scrapy/spiders/chile_compra_api_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ChileCompraAPIBase(IndexSpider, PeriodicSpider):

# PeriodicSpider
# The path parameters are {system}/{year}/{month}/{offset}/{limit}.
pattern = 'http://api.mercadopublico.cl/APISOCDS/OCDS/{0}/{1.year:d}/{1.month:02d}/{2}/{3}'
pattern = 'https://api.mercadopublico.cl/APISOCDS/OCDS/{0}/{1.year:d}/{1.month:02d}/{2}/{3}'
formatter = staticmethod(components(-4, -1)) # year-month-offset
start_requests_callback = 'parse_list'

Expand Down Expand Up @@ -82,21 +82,6 @@ def parse_page(self, response):
def handle_item(self, item):
pass

# from IndexSpider
def parse_list_loader(self, response):
data = response.json()

# Some files contain invalid packages, e.g.:
# {
# "status": 500,
# "detail": "error"
# }
if data.get('status') != 200:
data['http_code'] = data['status']
return self.build_file_error_from_response(response, errors=data)

return data

# from IndexSpider
def url_builder(self, value, data, response):
# URL looks like http://api.mercadopublico.cl/APISOCDS/OCDS/listaOCDSAgnoMesTratoDirecto/2021/03/31500/100
Expand Down

0 comments on commit 0a88662

Please sign in to comment.