Skip to content

Commit

Permalink
Fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
aguilerapy committed Oct 5, 2020
1 parent d6e5f87 commit fccbd4a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions kingfisher_scrapy/base_spider.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class BaseSpider(scrapy.Spider):

ocds_version = '1.1'
date_format = 'date'
date_required = None

def __init__(self, sample=None, note=None, from_date=None, until_date=None, crawl_time=None,
keep_collection_open=None, package_pointer=None, release_pointer=None, truncate=None, qs=None, *args,
Expand All @@ -96,6 +97,7 @@ def __init__(self, sample=None, note=None, from_date=None, until_date=None, craw
self.qs = qs

self.date_format = self.VALID_DATE_FORMATS[self.date_format]
self.date_required = self.date_required
self.pluck = bool(package_pointer or release_pointer)

if self.qs and hasattr(self, 'start_requests'):
Expand Down
5 changes: 3 additions & 2 deletions kingfisher_scrapy/spiders/nicaragua_solid_waste.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ class NicaraguaSolidWaste(SimpleSpider):
url = 'http://www.gekoware.com/swmp/api/ocds/{}/{}'

def start_requests(self):
url = self.url
if self.sample:
# date parameter setting to get one release from 2013
url = self.url.format('20130123', '20130123')
url = url.format('20130123', '20130123')
else:
if self.from_date and self.until_date:
# date parameter obtained
url = self.url.format(self.from_date.strftime("%Y%m%d"), self.until_date.strftime("%Y%m%d"))
url = url.format(self.from_date.strftime("%Y%m%d"), self.until_date.strftime("%Y%m%d"))

# url looks like http://www.gekoware.com/swmp/api/ocds/20190101/20201005
yield self.build_request(url, formatter=components(-2))

0 comments on commit fccbd4a

Please sign in to comment.