def start_requests(self): today = date.today() if hasattr(self, 'year'): year = int(self.year) start = date(year, 1, 1) stop = date(year, 12, 1) if year == today.year: stop = stop.replace(month=today.month) else: start = date(2008, 1, 1) stop = today if self.sample: start = stop for d in date_range_by_month(start, stop): yield self.build_request( self.base_list_url.format(d, 0, self.limit), formatter=components(-4, -1), meta={ 'year': d.year, 'month': d.month, }, callback=self.parse_list )
def start_requests(self): url = 'https://ocds.blob.core.windows.net/ocds/{0.year:d}{0.month:02d}.zip' start = date(2009, 1, 1) stop = date.today().replace(day=1) for d in date_range_by_month(start, stop): yield self.build_request(url.format(d), formatter=components(-1))
def start_requests(self): url = 'http://comprasestatales.gub.uy/ocds/rss/{0.year:d}/{0.month:02d}' if self.sample: self.from_date = self.until_date for d in date_range_by_month(self.from_date, self.until_date): yield self.build_request(url.format(d), formatter=components(-2), callback=self.parse_list)
def start_requests(self): start = self.from_date stop = self.until_date if self.date_format == '%Y': date_range = util.date_range_by_year(start.year, stop.year) else: date_range = util.date_range_by_month(start, stop) for date in date_range: for url in self.build_urls(date): yield self.build_request(url, self.get_formatter(), callback=self.start_requests_callback)
def parse_requests(self, pattern): notice_types = [ 1, # OJEU - F1 - Prior Information Notice 2, # OJEU - F2 - Contract Notice 3, # OJEU - F3 - Contract Award Notice 4, # OJEU - F4 - Prior Information Notice(Utilities) 5, # OJEU - F5 - Contract Notice(Utilities) 6, # OJEU - F6 - Contract Award Notice(Utilities) 7, # OJEU - F7 - Qualification Systems(Utilities) 12, # OJEU - F12 - Design Contest Notice 13, # OJEU - F13 - Results Of Design Contest 14, # OJEU - F14 - Corrigendum 15, # OJEU - F15 - Voluntary Ex Ante Transparency Notice 20, # OJEU - F20 - Modification Notice 21, # OJEU - F21 - Social And other Specific Services(Public Contracts) 22, # OJEU - F22 - Social And other Specific Services(Utilities) 23, # OJEU - F23 - Social And other Specific Services(Concessions) 24, # OJEU - F24 - Concession Notice 25, # OJEU - F25 - Concession Award Notice 101, # Site Notice - Website Contract Notice 102, # Site Notice - Website Prior Information Notice 103, # Site Notice - Website Contract Award Notice 104, # Site Notice - Quick Quote Award ] now = date.today() if self.from_date: start = date(self.from_date.year, self.from_date.month, 1) else: start = date(now.year - 1, now.month, 1) if self.sample: start = now for d in date_range_by_month(start, now): date_string = '{:02d}-{:04d}'.format(d.month, d.year) for notice_type in notice_types: yield self.build_request( pattern.format(date_string, notice_type), formatter=parameters('noticeType', 'dateFrom'))