Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from kingfisher_scrapy.base_spider import SimpleSpider | ||
from kingfisher_scrapy.util import components | ||
|
||
|
||
class Kosovo(SimpleSpider): | ||
""" | ||
Domain | ||
Public Procurement Regulatory Commission | ||
Spider arguments | ||
from_date | ||
Download only data from this date onward (YYYY-MM-DDTHH:mm:ss format). | ||
If ``until_date`` is provided, defaults to '2000-01-01T00:00:00'. | ||
until_date | ||
Download only data until this date (YYYY-MM-DDTHH:mm:ss format). | ||
If ``from_date`` is provided, defaults to today. | ||
API documentation | ||
https://ocdskrpp-test.rks-gov.net/Help | ||
""" | ||
name = 'kosovo' | ||
data_type = 'release_list' | ||
date_format = 'datetime' | ||
default_from_date = '2000-01-01T00:00:00' | ||
|
||
def start_requests(self): | ||
stages = ['Award', 'Tender', 'Bid'] | ||
url = 'https://ocdskrpp-test.rks-gov.net/krppAPI/{}' | ||
headers = {'accept': 'application/json', 'Content-Type': 'application/json'} | ||
|
||
if self.from_date and self.until_date: | ||
from_date = self.from_date.strftime(self.date_format) | ||
until_date = self.until_date.strftime(self.date_format) | ||
url = f'{url}?endDateFrom={from_date}&endDateEnd={until_date}' | ||
|
||
for stage in stages: | ||
yield self.build_request( | ||
url.format(stage), | ||
headers=headers, | ||
formatter=components(-1) | ||
) |