Skip to content

Commit

Permalink
Merge 149fcdc into 6ff729a
Browse files Browse the repository at this point in the history
  • Loading branch information
aguilerapy committed Sep 2, 2020
2 parents 6ff729a + 149fcdc commit ffe5a4e
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions kingfisher_scrapy/spiders/dominican_republic_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import scrapy

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


class DominicanRepublicPortal(LinksSpider):
"""
API documentation
http://148.101.176.123:48080/ocdsdr/docs
Spider arguments
sample
Downloads the first release package returned by the main endpoint.
from_date
Download only data from this date onward (YYYY-MM-DD format).
If ``until_date`` is provided, defaults to '2018-01-01'.
until_date
Download only data until this date (YYYY-MM-DD format).
If ``from_date`` is provided, defaults to today.
"""
name = 'dominican_republic_api'
data_type = 'release_package'
default_from_date = '2018-01-01'
next_page_formatter = staticmethod(parameters('page'))

def start_requests(self):
url = 'http://148.101.176.123:48080/ocdsdr/api/v1/releases'
if self.from_date and self.until_date:
url = url + '/byDatesBetween/{}/{}'.format(
self.from_date.strftime('%Y-%m-%d'),
self.until_date.strftime('%Y-%m-%d')
)
yield scrapy.Request(url, meta={'file_name': 'page-1.json'})

0 comments on commit ffe5a4e

Please sign in to comment.