Esempio n. 1
0
 def test_XueqiuSpider(self):
     spider = XueqiuSpider()
     r = []
     r = spider.results()
     self.assertGreater(len(r), 1000)
     if not isinstance(r[0], XueqiuStock):
         raise Exception('type error: result item is not Stock instance')
     dao = XueqiuDao('db.sqlite3', 'xueqiu')
     dao.update(r)
Esempio n. 2
0
 def test_XueqiuSpider(self):
     spider = XueqiuSpider()
     r = []
     r = spider.results()
     self.assertGreater(len(r),1000)
     if not isinstance(r[0],XueqiuStock):
         raise Exception('type error: result item is not Stock instance')
     dao = XueqiuDao('db.sqlite3','xueqiu')
     dao.update(r)
Esempio n. 3
0
 def run(self):
     try:
         spider = XueqiuSpider(auto_perform=False)
         stock_ctrl_factory = StockCtrlFactory(self.setting)
         stock_ctrl = stock_ctrl_factory.create_stock_ctrl('xueqiu')
         spider.set_call_back(self)
         spider.perform()
         self.results = spider.results()
         stock_ctrl.update_by_result(self.results)
         self.succeed = True
     except Exception as e:
         self.succeed = False
         self.emit(QtCore.SIGNAL('except(const QString&)'), unicode(e))
Esempio n. 4
0
 def run(self):
     try:
         spider = XueqiuSpider(auto_perform=False)
         stock_ctrl_factory = StockCtrlFactory(self.setting)
         stock_ctrl = stock_ctrl_factory.create_stock_ctrl('xueqiu')
         spider.set_call_back(self)
         spider.perform()
         self.results = spider.results()
         stock_ctrl.update_by_result(self.results)
         self.succeed = True
     except Exception as e:
         self.succeed = False
         self.emit(QtCore.SIGNAL('except(const QString&)'),unicode(e))
Esempio n. 5
0
 def test_XueqiuDao_Update(self):
     spider = XueqiuSpider()
     ret = spider.results()
     dao = XueqiuDao('../db.sqlite3','xueqiu')
     dao.update(ret)
     self.assertEqual(len(ret),len(dao.all()))
Esempio n. 6
0
 def test_XueqiuDao_Update(self):
     spider = XueqiuSpider()
     ret = spider.results()
     dao = XueqiuDao('../db.sqlite3', 'xueqiu')
     dao.update(ret)
     self.assertEqual(len(ret), len(dao.all()))