Beispiel #1
0
 def handle(self, *args, **options):
     biz_date = to_biz_date(datetime.datetime.now())
     file_path = jsonl_file_path(biz_date)
     writer = Writer(file_path)
     for shop in Shop.scrapeable():
         print shop.id  # TODO django-logging
         page = Page(shop)
         scr = Scraper(page)
         data = scr.extract_data()
         writer.write(data)
     writer.file.close()
Beispiel #2
0
 def test_saves(self):
     girl = Girl.objects.create(
         id='1000000000',
         shop=Shop.find_by_pk('honeyplaza'),
         name='てす子',
         age=23,
         img_url='http://example.com/tesko.jpg'
     )
     atnd = Attendance.objects.create(
         girl=girl,
         date=datetime.date(2016, 2, 2),
         clock_in=datetime.datetime(2016, 2, 2, 20, 30, 0),
         clock_out=datetime.datetime(2016, 2, 3, 3, 0, 0)
     )
     log = StatusLog.objects.create(
         attendance=atnd,
         checked_at=datetime.datetime(2016, 2, 2, 20, 30, 0),
         status='work',
     )
     self.assertEqual(log.id, '1000000000-20160202-203000')