コード例 #1
0
 def test_zhanhui_serach_result(self):
     '''获取所有展会数据,并依次打开所有展会详情页'''
     web_response = requests.get(self.zhanhui_search_result_url)
     soup = BeautifulSoup(web_response.text, 'lxml')
     targets = soup.select('div.searchlist > ul > li > a')
     for target in targets:
         self.zhanhui_links.append('http:' + target.get('href'))
     assert len(self.zhanhui_links) > 500
     open_links(self.zhanhui_links, self.zhanhui_links_error)
コード例 #2
0
 def test_zhanzhuang_search_result(self):
     '''获取所有展装数据,并依次打开所有展装详情页'''
     web_response = requests.get(self.zhanzhuang_search_result_url)
     soup = BeautifulSoup(web_response.text, 'lxml')
     targets = soup.select('span.zd_one > h3 > a')
     for target in targets:
         self.zhanzhuang_links.append('http:' + target.get('href'))
     assert len(self.zhanzhuang_links) > 600
     open_links(self.zhanzhuang_links, self.zhanzhuang_links_error)
コード例 #3
0
 def test_txzhanshang(self):
     '''测试天下展商首页数据,并打开详情页'''
     data1 = {
         'archileLocationCode': 'Txzhanshang',
         'extArchileLocationCode':
         "'NewsFlash_Txzhanshang','Cx_Txzhanshang_xwdsr','Cx_Txzhanshang_qys','Cx_Txzhanshang_dks','Cx_Txzhanshang_mtjj','G20_Txzhanshang_Toutiao','G20_Txzhanshang_Depth','G20_Txzhanshang_LastNews','G20_Txzhanshang_Comment','G20_Txzhanshang_Talk','G20_Txzhanshang_SecrectNews','G20_Txzhanshang_Notes','NewsConference_Txzhanshang_Media','NewsConference_Txzhanshang_Sets','NewsConference_Txzhanshang_Work','NewsConference_Txzhanshang_Watch','NewsConference_Txzhanshang_Top','GuoQing_Txzhanshang_House','GuoQing_Txzhanshang_Car','GuoQing_Txzhanshang_Game','GuoQing_Txzhanshang_Floor','GuoQing_Txzhanshang_Forgain','GuoQing_Txzhanshang_Other','GJH_Txzhanshang_FocuNews','GJH_Txzhanshang_FuncChange','GJH_Txzhanshang_Zhaoshang','GJH_Txzhanshang_SecrectNews','GJH_Txzhanshang_Chuzheng','GJH_Txzhanshang_History','GJH_Txzhanshang_Comment','GaoJH_Txzhashang_Focus','GaoJH_Txzhashang_On','GaoJH_Txzhashang_Exhibitor','GaoJH_Txzhashang_Popular','GaoJH_Txzhashang_Guide','GaoJH_Txzhashang_Booth','GaoJH_Txzhashang_Other','GaoJH_Txzhashang_Events'",
         'pageIndex': 1,
         'pageSize': 20,
         'type': 1,
         'menuIndex': 1
     }
     data2 = {
         'archileLocationCode': 'Txzhanshang_Special',
         'pageIndex': 1,
         'pageSize': 20,
         'type': 2,
         'menuIndex': 2
     }
     data3 = {
         'archileLocationCode': 'Txzhanshang_Depth',
         'pageIndex': 1,
         'pageSize': 20,
         'type': 2,
         'menuIndex': 3
     }
     data4 = {
         'archileLocationCode': 'Txzhanshang_Image',
         'pageIndex': 1,
         'pageSize': 20,
         'type': 2,
         'menuIndex': 4
     }
     data5 = {
         'archileLocationCode': 'Txzhanshang_Character',
         'pageIndex': 1,
         'pageSize': 20,
         'type': 2,
         'menuIndex': 5
     }
     datas = [data1, data2, data3, data4, data5]
     for data in datas:
         txzhanshang_ids = []
         error_links = []
         web_response = requests.post(self.txzhanshang_data_url, data=data)
         dr = re.compile(r'<[^>]+>|\\r\\n', re.S)
         dd = dr.sub('', web_response.text)
         count = int(json.loads(dd)['totalCount'])
         assert count > 0
         res = '{"res":' + json.loads(dd)['archiles'] + "}"
         for item in json.loads(res)['res']:
             txzhanshang_ids.append(item['ID'])
         open_links([
             'http://txzhanshang.zhankoo.com/detail/{}.html'.format(i)
             for i in txzhanshang_ids
         ], error_links)
コード例 #4
0
 def test_xiaoguotu_search_result(self):
     '''获取所有效果图数据,并打开前20个效果图详情页'''
     data = {'pageIndex': 1}
     web_response = requests.post(self.xiaoguotu_search_result_url,
                                  data=data)
     result_json = json.loads(web_response.text)
     total = result_json['total']
     assert int(total) > 1000
     data = result_json['data']
     for unit in data:
         self.xiaoguotu_ids.append(unit['ID'])
     xiaoguotu_links = [
         'http://exh.zhankoo.com/xiaoguotu/{}.html'.format(str(i))
         for i in self.xiaoguotu_ids
     ]
     open_links(xiaoguotu_links, self.xiaoguotu_links_error)
コード例 #5
0
 def test_open_channel_page(self):
     '''打开所有频道页'''
     open_links(self.channels.split(), self.links_error)