class TopItemTestCase(unittest.TestCase): def setUp(self): self.db_conn_pool = ConnectionPool(max_connections=1000, host='223.4.216.246', user='******', passwd='spider', db='topspider') def test_topitem(self): for iid in [ # '14175613296', '8264246386', # '10002994827', # '13746707210', # '10399774244' # '20807952786', # '10710811953', '12979720957' ]: link = 'http://item.taobao.com/item.htm?id=%s' % iid # link = 'http://detail.tmall.com/item.htm?id=%s' % iid d = TopItem(link).getFullInfo() print json.dumps(d, indent=4, ensure_ascii=False) # .decode('utf-8') saveTopItem(d, self.db_conn_pool) pass def tearDown(self): self.db_conn_pool.disconnect()
def setUp(self): self.db_conn_pool = ConnectionPool(max_connections=1000, host='223.4.155.152', user='******', passwd='spider', db='topspider', charset='utf8')
class TopItemTestCase(unittest.TestCase): def setUp(self): self.db_conn_pool = ConnectionPool( max_connections=1000, host='223.4.155.152', user='******', passwd='spider', db='topspider', charset='utf8' ) def test_topitem(self): for iid in [ '19480718829', # 2 ]: link = 'http://item.taobao.com/item.htm?id=%s' % iid # link = 'http://detail.tmall.com/item.htm?id=%s' % iid d = TopItem(link).getFullInfo() # d = TopItem(link).getBasicInfo() print json.dumps(d, indent=4, ensure_ascii=False) # saveTopItem(d, self.db_conn_pool) def tearDown(self): self.db_conn_pool.disconnect()
def setUp(self): self.db_conn_pool = ConnectionPool( max_connections=1000, host='223.4.155.152', user='******', passwd='spider', db='topspider', charset='utf8' )
class TopItemTestCase(unittest.TestCase): def setUp(self): self.db_conn_pool = ConnectionPool(max_connections=1000, host='223.4.155.152', user='******', passwd='spider', db='topspider', charset='utf8') def test_topitem(self): for iid in [ '19480718829', # 2 ]: link = 'http://item.taobao.com/item.htm?id=%s' % iid # link = 'http://detail.tmall.com/item.htm?id=%s' % iid d = TopItem(link).getFullInfo() # d = TopItem(link).getBasicInfo() print json.dumps(d, indent=4, ensure_ascii=False) # saveTopItem(d, self.db_conn_pool) def tearDown(self): self.db_conn_pool.disconnect()
def setUp(self): self.db_conn_pool = ConnectionPool(max_connections=1000, host='223.4.216.246', user='******', passwd='spider', db='topspider')
'saveTopShopData', 'saveTopItemsLink', 'saveTopItem', 'saveTopRate', 'saveTopTrade', 'saveTopAllitemInfo', 'saveKeywordSearchResult', ] import time import MySQLdb from lib import getDBConn, escapeSQLCommand from config import mysql_ip_config from connectionpool import ConnectionPool connpool = ConnectionPool(max_connections=10, **mysql_ip_config.get('152')) DB = 'topspider' mapping_topshop = {'table': 'topspider.top_shop', 'fields': [ 'shopId', 'userId', 'shopLink', 'shopName', 'wangwangNick', 'shopRank', 'shopGrade', 'shopRate', 'shopKeeper', 'company', 'location', 'goodsRate',