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)