突突突突突突

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
import requests

base_url = '125.35.6.84:81/xk' # GG

index_url = 'http://125.35.6.84:81/xk/itownet/portalAction.do?method=getXkzsList'

detail_url = 'http://125.35.6.84:81/xk/itownet/portalAction.do?method=getXkzsById'

_data = {
    'on': 'true',
    'page': '1',
    'pageSize':'15',
    'productName':'',
    'conditionType': '1',
    'applyname':'',
    'applysn':''

}
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36'
}

pro_list = requests.post(index_url, data=_data).json().get('list')


def write(pro_name, text):
    with open(f'{pro_name}.json', 'w', encoding='utf-8') as f:
        f.write(text)


for pro in pro_list:
    res = requests.post(url=detail_url, data={'id':pro.get('ID')}, headers=headers)
    write(pro.get("EPS_NAME"), res.text)

 

posted on 2019-02-26 17:12  徐建0304  阅读(693)  评论(0编辑  收藏  举报