예제 #1
0
    def start_requests(self):
        end_date = datetime.date.today()
        delta = end_date - self.start_date

        for i in range(delta.days + 1):
            this_date = self.start_date + timedelta(days=i)
            this_year = datetime.datetime.strftime(this_date, '%Y')
            this_month = utils.get_this_month(datetime.datetime.strftime(this_date, '%m'))
            this_date_str = datetime.datetime.strftime(this_date, '%d%m%Y')
            url = "http://tc.gob.pe/transparencia/visitas/"
            url += this_year + "/"
            url += this_month + "/"

            if this_date < datetime.date(2009, 8, 1):
                url += this_date_str + ".htm"
            else:
                url += this_date_str + ".html"
            request = scrapy.Request(url, callback=self.parse)
            request.meta['date'] = this_date
            yield request
예제 #2
0
    def start_requests(self):
        end_date = datetime.date.today()
        delta = end_date - self.start_date

        for i in range(delta.days + 1):
            this_date = self.start_date + timedelta(days=i)
            this_year = datetime.datetime.strftime(this_date, '%Y')
            this_month = utils.get_this_month(
                datetime.datetime.strftime(this_date, '%m'))
            this_date_str = datetime.datetime.strftime(this_date, '%d%m%Y')
            url = "http://tc.gob.pe/transparencia/visitas/"
            url += this_year + "/"
            url += this_month + "/"

            if this_date < datetime.date(2009, 8, 1):
                url += this_date_str + ".htm"
            else:
                url += this_date_str + ".html"
            request = scrapy.Request(url, callback=self.parse)
            request.meta['date'] = this_date
            yield request
예제 #3
0
 def test_diciembre(self):
     expected = 'diciembre'
     result = get_this_month('12')
     self.assertEqual(expected, result)
예제 #4
0
 def test_diciembre(self):
     expected = 'diciembre'
     result = get_this_month('12')
     self.assertEqual(expected, result)