Skip to content

Commit

Permalink
Update changes from review
Browse files Browse the repository at this point in the history
  • Loading branch information
aguilerapy committed May 5, 2021
1 parent 437154f commit 89b3f50
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion kingfisher_scrapy/commands/checkall.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def check_date_spider_argument(self, spider_argument, spider_arguments, default,
if spider_argument in spider_arguments:
# These classes are known to have more specific semantics.
if self.cls.__name__ in ('ColombiaBulk', 'PortugalRecords', 'PortugalReleases',
'ScotlandPublicContracts'):
'ScotlandPublicContracts', 'Uganda'):
level = 'info'
else:
level = 'warning'
Expand Down
10 changes: 6 additions & 4 deletions kingfisher_scrapy/spiders/uganda_releases.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,24 @@ class Uganda(IndexSpider):
Government Procurement Portal (GPP) of Public Procurement and Disposal of Public Assets Authority (PPDA)
Spider arguments
from_date
Download only data from this year onward (YYYY format). Defaults to '2017'.
Download only data from this year onward (YYYY format).
If ``until_date`` is provided, defaults to '2017'.
The year refers to the start of the fiscal year range, e.g. if from_date='2017' then fiscal_year='2017-2018'
until_date
Download only data until this year (YYYY format). Defaults to the current year.
Download only data until this year (YYYY format).
If ``from_date`` is provided, defaults to the current year.
The year refers to the start of the fiscal year range, e.g. if until_date='2017' then fiscal_year='2017-2018'
API documentation
https://docs.google.com/spreadsheets/d/10tVioy-VOQa1FwWoRl5e1pMbGpiymA0iycNcoDFkvks/edit#gid=365266172
"""
name = 'uganda_releases'
download_delay = 30 # to avoid API 429 error "too many request"
date_format = 'year'
custom_settings = {
'CONCURRENT_REQUESTS': 1,
}

# BaseSpider
date_format = 'year'
default_from_date = '2017'

# SimpleSpider
Expand Down Expand Up @@ -54,7 +56,7 @@ def parse_data(self, response):
for plans in pdes['procurement_plans']:
for tag in ('planning', 'tender', 'award', 'contract'):
if self.from_date and self.until_date:
start_year = int(plans['financial_year'].split("-")[0])
start_year = int(plans['financial_year'].split('-')[0])
if not (self.from_date.year <= start_year <= self.until_date.year):
continue
yield self.build_request(
Expand Down

0 comments on commit 89b3f50

Please sign in to comment.