其他分享
首页 > 其他分享> > 爬取药监总局中相关企业的详情信息

爬取药监总局中相关企业的详情信息

作者:互联网

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


#获取每一家企业的id
url = 'http://125.35.6.84:81/xk/itownet/portalAction.do?method=getXkzsList'
for page in range(1,6):
    print('正在爬取第{}页的数据......'.format(page))
    data = {
        'on': 'true',
        'page': str(page),
        'pageSize': '15',
        'productName': '',
        'conditionType': '1',
        'applyname': '',
        'applysn':'',
    }
    company_data = requests.post(url,headers=headers,data=data).json()
    for dic in company_data['list']:
        _id = dic['ID']
        detail_url = 'http://125.35.6.84:81/xk/itownet/portalAction.do?method=getXkzsById'
        data = {
            'id':_id
        }
        detail_data = requests.post(url=detail_url,data=data,headers=headers).json()
        print(detail_data['epsName'],detail_data['legalPerson'])

标签:url,数据包,取药,总局,详情,动态,data,id,加载
来源: https://www.cnblogs.com/5kuishoua666/p/12021683.html