Source code for kingfisher_scrapy.spiders.colombia_api

import scrapy

from kingfisher_scrapy.base_spiders import LinksSpider
from kingfisher_scrapy.util import parameters

[docs]class ColombiaAPI(LinksSpider): """ Domain Colombia Compra Eficiente (CCE) Spider arguments from_date Download only data from this date onward (YYYY-MM-DD format). Defaults to '2011-01-01'. until_date Download only data until this date (YYYY-MM-DD format). Defaults to today. API documentation Swagger API documentation """ name = 'colombia_api' # BaseSpider default_from_date = '2011-01-01' # The endpoint without date parameters also works but is slower. date_required = True # SimpleSpider data_type = 'release_package' # LinksSpider formatter = staticmethod(parameters('_id')) def start_requests(self): url = '' \ f'{self.from_date.strftime(self.date_format)}/{self.until_date.strftime(self.date_format)}' yield scrapy.Request(url, meta={'file_name': 'page-1.json'})